Is the default handling of nan by plot the "right" one?
I am accustomed (from GAUSS) to missing values being
treated as "gaps".
fails completely. I expect the last 4 numbers to be plotted.
plots a single line. I expect two segments and a gap.
Slightly modifying a reply to a similar question not long ago:
At present, you need to use masked arrays instead of NaN. NaN is not uniformly supported in Python and numerix, but masked arrays, in both numarray and Numeric, can accomplish the same thing and more. See masked_demo.py in the mpl examples subdirectory, and see http://stsdas.stsci.edu/numarray/numarray-1.3.html/module-numarray.ma.html
for an explanation of masked arrays.
Numeric is in the midst of a major revision (including renaming), which I think will include support of NaNs similar to that in numarray. When this new version becomes common, then it may be both possible and desirable for matplotlib to handle NaNs as smoothly as Matlab, Octave, and evidently Gauss do.