On Thu, Jun 17, 2010 at 10:52 AM, Andreas Hilboll <li...@hilboll.de> wrote:
> Hi there,
>
> I just noticed today that when I call hist() on a masked_array, also those
> values which are masked out are displayed (with their fill_value). Is that
> really the desired behaviour?
>
> I'm working in an environment where we're mostly using masked_array, but
> also sometimes the 'normal' ndarray. So I would need to do something like
>
> try:
>  data = data.compressed()
> except:
>  pass
> hist(data)
>
> all the time ... Is there any easier solution?

Unfortunately, these lines in Axes.hist():

            # TODO: support masked arrays;
            x = np.asarray(x)

say it all. I think changing to asanyarray() should work (I'm not sure
what, if anything, this would break), but there's no way for you to
get this behavior without editing your local copy of axes.py.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to