On Wed, Mar 25, 2009 at 3:02 PM, Eric Firing <efir...@hawaii.edu> wrote:

> Darren Dale wrote:
>
>> I am experimenting with numpy masked arrays, and have a question about how
>> imshow handles them:
>>
>> from numpy import ma
>> from pylab import colorbar, imshow, show
>>
>> a=ma.array([[1,2,3],[4,5,6]],mask=[[0,0,1],[0,0,0]], fill_value=0)
>> imshow(a, interpolation='nearest')
>> colorbar()
>> show()
>>
>> With svn matplotlib, the missing value is treated as if identical to the
>> maximum value. I thought imshow would instead respect the masked array's
>>
> I don't see this with my installation from svn.
>
>> fill_value property by calling fix_invalid, and perhaps defaulting to the
>> min() or max() if fill_value is the default 999999. What is the intended
>> behavior?
>>
>
> What I see with your example is a white square for the masked value;
> actually, it is transparent, with alpha = 0.  This is the intended default;
> if it is masked, don't paint anything.  It is set in Colormap.__init__ and
> can be overridden by Colormap.set_bad().
>

I was using a greyscale colormap that painted the max value white, and I
confused no paint with max value. Personally, I think black would have been
a better default, but no matter. Thank you for the clarification.


>
> There is no intention to use the masked array fill value.
>
>
>> Relatedly, it looks like imshow and other functions like contour are badly
>> confused by NaNs, I thought they were supported?
>>
>
> I suspect we really should run the Z inputs through masked_invalid,
> especially for contour.  The performance hit is minimal as a fraction of the
> total time.  I will do this for contour.  imshow has to be handled more
> carefully, so I don't want to do it in a hurry.
>

Ok.

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

Reply via email to