Missing values in plots with NaN?

Hi,

Is there any easy way of adding missing points to a (line) plot? Matlab can do this using NaN, but as far as I can tell matplotlib doesn't support this. Something like the code below would be nice, but I don't know if this is Numeric compatible/cross platform enough/etc?

from numarray.ieeespecial import *
plot([10, 20, nan, 30])

I guess I can do split(source array) --> a, b and then plot(a, linestyle, b, linestyle) but having missings directly in the array would be preferable if possible.

This would be very nice. Gnuplot has a similar characteristic: to
create the plots at San Fernando Observatory (SFO), I use a trick like this:

f(x) = (x==-999999 ? 1/0 : x)
plot "file" using $1:(f($2))

so that an equally spaced time series appears with gaps where we have
missing data.

Hmmm...is this something which should be supported via masked arrays? I
tried plotting a masked array with matplotlib and numarray's MA package,
and found matplotlib checks for the existence of a mask but throws an
exception if you try to plot it.

ยทยทยท

On Wed, 2004-08-18 at 15:02, Mark Howson wrote:

Hi,

Is there any easy way of adding missing points to a (line) plot? Matlab
can do this using NaN, but as far as I can tell matplotlib doesn't
support this.