Alpha and colorbar using contourf

Tom,

I have made several changes in svn to improve the ability of colorbar to track changes in colormap and alpha. It works with imshow, pcolor, and contourf. The implementation could be improved--maybe later. Here are minimal illustrations you can use with ipython -pylab:

figure(); C = pcolor(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()

figure(); C = contourf(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()

figure(); C = imshow(rand(3,3)); colorbar(); C.set_alpha(0.4); draw()

The agg backend has trouble rendering the "continuous" colorbar with non-unit alpha; it comes out somewhat striped. Turning on antialiasing makes it better for small to moderate alpha, but causes similar artifacts to appear for alpha=1, so I don't know of any good solution. Good appearance is more important for the most common case of alpha=1, so I am leaving antialiasing off. I haven't checked other backends that support alpha.

Eric

Thanks, Eric. I will try it.

···

On 11/14/06, Eric Firing <efiring@…202…> wrote:

Tom,

I have made several changes in svn to improve the ability of colorbar to
track changes in colormap and alpha. It works with imshow, pcolor, and

contourf. The implementation could be improved–maybe later. Here are
minimal illustrations you can use with ipython -pylab:

figure(); C = pcolor(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()

figure(); C = contourf(rand(3,3)); colorbar(); C.set_alpha(0.5); draw()

figure(); C = imshow(rand(3,3)); colorbar(); C.set_alpha(0.4); draw()

The agg backend has trouble rendering the “continuous” colorbar with
non-unit alpha; it comes out somewhat striped. Turning on antialiasing

makes it better for small to moderate alpha, but causes similar
artifacts to appear for alpha=1, so I don’t know of any good solution.
Good appearance is more important for the most common case of alpha=1,
so I am leaving antialiasing off. I haven’t checked other backends that

support alpha.

Eric


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share your

opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users