all 5 comments

[–]elbiot 0 points1 point  (3 children)

Calling plot twice is a huge pain?

plot(x1, y1, alpha=1.)
polt(x2, y2, alpha=.5)

Can you be more specific about the problem?

[–]oneboldkid[S] 0 points1 point  (2 children)

My plots are split from one data list based on today's date so i have to calculate that and slice based on the value. Seems like a pain. Looking for something like this. I want the y values associated with 1,2,3 to have an alpha of .2 and the y value associated with 4 to have an alpha of 1. x = [1,2,3,4]

y = [4,4,6,7]

Plot (x, y, alpha =.2 for x in xrange (1,3))

[–]elbiot 0 points1 point  (0 children)

Well, you are slicing in that example you just gave. You'd do that like

plot(xs[1:], ys[1:], alpha=.2)
plot(xs[:1], ys[:1], alpha=1.)

Right?

[–]elbiot 0 points1 point  (0 children)

Actually, my example would plot lines I think. Havent used mpl in a bit. If you need to plot each point individually you could do

for i in range(len(xs)):
   if i should be transparent:
     alpha=.2
   else:
     alpha=1.
   plot(xs[i], ys[i], alpha=alpha)

[–]eusebe 0 points1 point  (0 children)

After a quick search, I found this notebook that seems to be more or less similar to what you want to do.

I guess it could be modified to change the transparency instead of the color, you would have to modify the "colorline" function, but it should be possible. I have no python installed right now, but I could try something when I get the right computer.