On Wed, Apr 29, 2009 at 6:40 AM, Andres Luhamaa <andres.luha...@ut.ee>wrote:

> Hello,
> I try to do fill_between two arrays, that have missing value (masked
> arrays). Following code shows behaviour that seems not correct. Images what
> I expect the result to be (by omitting the missing value) and what I get by
> plotting the whole arrays.
>
> import pylab
> import numpy as np
> edatmax=np.array([10,4,6,9,np.nan,9,10])
> edatmax=np.ma.masked_array(edatmax,np.isnan(edatmax))
> edatmin=np.array([8,4,5,1,np.nan,8,5])
> edatmin=np.ma.masked_array(edatmin,np.isnan(edatmin))
> xtelg=np.arange(edatmax.size)
> xtelg=np.ma.masked_array(xtelg,np.isnan(edatmin))
> pylab.plot(edatmax,"gx")
> pylab.plot(edatmin,"r+")
> # comment out to see better
> pylab.fill_between(xtelg,edatmax,edatmin,facecolor='green',alpha='0.3')
> # comment in to see better
>
> #pylab.fill_between(xtelg[:4],edatmax[:4],edatmin[:4],facecolor='green',alpha='0.3')
>
> #pylab.fill_between(xtelg[5:],edatmax[5:],edatmin[5:],facecolor='green',alpha='0.3')
> pylab.show()
>
> Version of matplotlib is current cvs.
>


fill_between does not currently support masked arrays, but I think we could
easily extend it to support the mask using the existing support for the
"where" kwarg.  For now, does this behave like you expect?

  valid = ~(edatmax.mask & edatmax.mask )
  pylab.fill_between(xtelg,edatmax,edatmin,facecolor='green',alpha='0.3',
where=valid)

JDH
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to