plotting masked data

John, Attached are a slightly modified lines.py, based on

    > CVS download this morning, and a demo of plotting masked
    > arrays.

Hi Eric,

I'm getting an exception when I try and run the example you provided
-- I see the same thing with numarray. I'll attach the example below
too, for the sake of completeness, but it is unmodified

peds-pc311:~/python/projects/matplotlib/examples> python masked_demo.py --Numeric --verbose-helpful
matplotlib data path /usr/local/share/matplotlib
loaded rc file /home/jdhunter/.matplotlibrc
matplotlib version 0.80
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.6
font search path ['/usr/local/share/matplotlib']
loaded ttfcache file /home/jdhunter/.ttffont.cache
backend WXAgg version 2.5.5.1
Traceback (most recent call last):
  File "masked_demo.py", line 19, in ?
    lines = plot(x, y, 'r', x, ym1, 'g', x, ym2, 'b.')
  File "/usr/local/lib/python2.3/site-packages/matplotlib/pylab.py", line 1930, in plot
    ret = gca().plot(*args, **kwargs)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 2409, in plot
    for line in self._get_lines(*args, **kwargs):
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 281, in _grab_next_args
    yield self._plot_3_args(remaining[:3], **kwargs)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 249, in _plot_3_args
    markeredgecolor=mec,
  File "/usr/local/lib/python2.3/site-packages/matplotlib/lines.py", line 135, in __init__
    self.set_data(xdata, ydata)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/lines.py", line 190, in set_data
    self._y = asarray(y, Float)
  File "/usr/local/lib/python2.3/site-packages/Numeric/Numeric.py", line 133, in asarray
    return multiarray.array(a, typecode, copy=0, savespace=savespace)
  File "/usr/local/lib/python2.3/site-packages/Numeric/MA/MA.py", line 632, in __array__
    raise MAError, \
MA.MA.MAError: Cannot automatically convert masked array to Numeric because data
                   is masked in one or more locations.

peds-pc311:~/python/projects/matplotlib/examples>
peds-pc311:~/python/projects/matplotlib/examples> python masked_demo.py --numarray --verbose-helpful
matplotlib data path /usr/local/share/matplotlib
loaded rc file /home/jdhunter/.matplotlibrc
matplotlib version 0.80
verbose.level helpful
interactive is False
platform is linux2
numerix numarray 1.1
font search path ['/usr/local/share/matplotlib']
loaded ttfcache file /home/jdhunter/.ttffont.cache
backend WXAgg version 2.5.5.1
Traceback (most recent call last):
  File "masked_demo.py", line 19, in ?
    lines = plot(x, y, 'r', x, ym1, 'g', x, ym2, 'b.')
  File "/usr/local/lib/python2.3/site-packages/matplotlib/pylab.py", line 1930, in plot
    ret = gca().plot(*args, **kwargs)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 2409, in plot
    for line in self._get_lines(*args, **kwargs):
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 281, in _grab_next_args
    yield self._plot_3_args(remaining[:3], **kwargs)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 249, in _plot_3_args
    markeredgecolor=mec,
  File "/usr/local/lib/python2.3/site-packages/matplotlib/lines.py", line 135, in __init__
    self.set_data(xdata, ydata)
  File "/usr/local/lib/python2.3/site-packages/matplotlib/lines.py", line 190, in set_data
    self._y = asarray(y, Float)
  File "/usr/local/lib/python2.3/site-packages/numarray/numarraycore.py", line 360, in asarray
    return array(seq, type=type, typecode=typecode, copy=0)
  File "/usr/local/lib/python2.3/site-packages/numarray/numarraycore.py", line 344, in array
    return sequence.__array__(type)
  File "/usr/local/lib/python2.3/site-packages/numarray/ma/MA.py", line 651, in __array__
    raise MAError, \
numarray.ma.MA.MAError: Cannot automatically convert masked array to Numeric because data
                   is masked in one or more locations.

masked_demo.py (605 Bytes)