Chris Withers wrote: > Eric Firing wrote: >> Chris, >> >> Use masked arrays. See masked_demo.py in the mpl examples subdirectory. > > Hi Eric, > > I took a look at that, but it uses: > > import matplotlib.numerix.npyma as ma > > ...and matplotlib.numerix isn't listed in the API reference. Where are > the docs for this?
numerix is obsolete, and numerix.npyma was a temporary method to provide access to either of two masked array implementations. It is probably time for me to remove it from the examples. Substitute import numpy.ma as ma The ma module is documented as part of numpy. > > Specifically, what I have is an array like so: > > ['','','',1.1,2.2] Try something like this: import numpy.ma as ma from pylab import * aa = [3.4, 2.5, '','','',1.1,2.2] def to_num(arg): if arg == '': return 9999.0 return arg aanum = array([to_num(arg) for arg in aa]) aamasked = ma.masked_where(aanum==9999.0, aanum) plot(aamasked) show() Eric > > I want to mask the strings out so I don't get ValueErrors raised when I > call plot functions with that array. > > How should I do that? > > cheers, > > Chris > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users