Eric Firing wrote:
>> 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()

What I ended up doing was getting my array to look like:

from numpy import nan
aa = [3.4,2.5,nan,nan,nan,1.1,2.2]
values = numpy.array(aa)
values = numpy.ma.masked_equal(values,nan)

I only wish that masked_equal didn't blow up when aa contains datetime 
objects :-(

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

-------------------------------------------------------------------------
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

Reply via email to