imshow only half of each unit

imshow fills an entire "unit" in the grid. I'd like to overlay two
imshow's on top of each other, but in a non-destructive manner. One
way of doing this would be to modify the behavior of imshow so that it
only fills a portion of each "unit" in the grid. For example, in the
first imshow, I'd fill everything below the diagonal and in the second
imshow, I'd fill everything above the diagonal.

Would this type of modification to AxesImage be feasible? Or should I
just (manually) make a PolyCollection for each imshow? I'd still want
interpolations to work as expected, but where filling (or not) is
restricted to a region within the "unit". Generally, I think this
could be a nice addition to mpl, but if there is a more typical way of
visualizing two imshows on the same axis, I might try that instead.

thanks.

The easiest would be using a masked array.

arr = np.arange(100).reshape((10,10))

iny, inx = np.indices(arr.shape)
mymask=inx+iny>=10
imshow(np.ma.array(arr, mask=mymask), cmap="gray")
imshow(np.ma.array(arr, mask=~mymask), cmap="jet")

However, I recommend you to use the clippath.

http://matplotlib.sourceforge.net/examples/api/clippath_demo.html

Regards,

-JJ

ยทยทยท

On Tue, Mar 8, 2011 at 6:46 PM, T J <tjhnson@...287...> wrote:

imshow fills an entire "unit" in the grid. I'd like to overlay two
imshow's on top of each other, but in a non-destructive manner. One
way of doing this would be to modify the behavior of imshow so that it
only fills a portion of each "unit" in the grid. For example, in the
first imshow, I'd fill everything below the diagonal and in the second
imshow, I'd fill everything above the diagonal.

Would this type of modification to AxesImage be feasible? Or should I
just (manually) make a PolyCollection for each imshow? I'd still want
interpolations to work as expected, but where filling (or not) is
restricted to a region within the "unit". Generally, I think this
could be a nice addition to mpl, but if there is a more typical way of
visualizing two imshows on the same axis, I might try that instead.

thanks.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options