>>>>> "Eric" == Eric Firing <[EMAIL PROTECTED]> writes:
Eric> John Hunter wrote:
>>>>>>> "Eric" == Eric Firing <[EMAIL PROTECTED]> writes:
>>
Eric> they will not be transparent. If you need transparent
Eric> masked regions, then try pcolor instead of imshow. Pcolor
Eric> plots nothing at all in masked cells. Pcolormesh, on the
Eric> other hand, is like imshow in plotting the assigned bad
Eric> color and in using a single alpha for everything.
>> I'm confused about the comments about alpha not working on
>> imshow -- can you elaborate. On the agg backend at least, the
>> alpha channel is respected in imshow, eg
>> examples/layer_images.py. Is there a reason it does not (or
>> should not) work in the masked example?
Eric> John,
Eric> I don't know why it doesn't work; I know only that in my
Eric> example, it doesn't work as I perhaps naively think it
Eric> should. My interpretation of alpha is that if alpha is zero
Eric> in any colored region, and if nothing else is drawn on top,
Eric> then the background should show through; that is, the r,g,b
Eric> values in the r,g,b,a tuple for a region should have no
Eric> effect if a is zero. If you uncomment
Eric> #cmap.set_bad((1,1,1,0) in my example, you will find that
Eric> the masked region is white; and if you change the rgb part
Eric> of that tuple, it takes on that color, regardless of alpha.
I'm not sure what is going on in your example, but this test case
shows that the alpha channel is respected. I made a red RGBA array
and set the alpha channel for the center to be transparent and it
behaves as expected: you can see the line through the transparent
region of the rectangle and the axes bgcolor shows through. I had to
make a small change to svn to make this work because the image wasn't
respecting the zorder (revision 2495). So the bug you are
experiencing is likely to be in the front-end code.
from pylab import figure, show, nx
# a red rectangle with a transparent center
X = nx.ones((20,20,4), nx.Float)
X[:,:,1] = 0
X[:,:,2] = 0
X[5:15,5:15,-1] = 0
fig = figure()
ax = fig.add_subplot(111)
l, = ax.plot(nx.arange(20))
l.set_zorder(2)
im = ax.imshow(X)
im.set_zorder(3) # put the image over the line
show()
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users