changing alpha in contourf according to z values

Dear list,

Is it possible to specify to contourf an alpha value which is not a pure number but lets say an array?

I would like to change the value of alpha according to the contourf values and to get in this way a fading effect on the vallies.

What about imshow?

Thank you v much,

I really enjoy the conversations in this list, and of course matplotlib.

Best Regards,

Tsviki Hirsh

Tsviki Hirsh wrote:

Dear list,

Is it possible to specify to contourf an alpha value which is not a pure number but lets say an array?
I would like to change the value of alpha according to the contourf values and to get in this way a fading effect on the vallies.

For contourf, one approach is to use the returned ContourSet.

cs = contourf(rand(10,10))
cs.collections[0].set_alpha(0.1)
draw()

So, you can cycle through the collections, setting the alpha for each to whatever you like.

What about imshow?

You would need to set the alpha values in the _lut attribute of the colormap. Unfortunately, this is an area of alpha-handling that is still a mess. I'm not sure whether it works for some colormap types, but at least for ListedColormap, it doesn't. The alpha values of the input colors are ignored. I've been wanting to overhaul this, but obviously haven't gotten to it.

Eric

ยทยทยท

Thank you v much,
I really enjoy the conversations in this list, and of course matplotlib.

Best Regards,
Tsviki Hirsh

------------------------------------------------------------------------

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users