Paul Novak wrote:
> I have a problem that arose when I tried to run the gridding irregularly
> spaced data demo on the wiki
> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>
> When I run the attached script, which sets one value of an array to 
> nan, masks the array where there are nan, and tries to plot it using 
> contour(), I get the following errors:
>
> /usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning: 
> Cannot automatically convert masked array to numeric because data
>     is masked in one or more locations.
>   warnings.warn("Cannot automatically convert masked array to "\
> Traceback (most recent call last):
>   File "masked_nan.py", line 18, in ?
>     contour(x, y, z)
>   File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 
> 1754, in contour
>     ret =  gca().contour(*args, **kwargs)
>   File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 
> 4092, in contour
>     return ContourSet(self, *args, **kwargs)
>   File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 429, in __init__
>     x, y, z = self._contour_args(*args)        # also sets self.levels,
>   File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 614, in _contour_args
>     lev = self._autolev(z, 7)
>   File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line 
> 517, in _autolev
>     zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
> TypeError: unsupported operand type(s) for -: 'str' and 'str'
>
> I am using
> >>> numpy.__version__
> '1.0'
> >>> matplotlib.__version__
> '0.87.7'
>
> Is there a way to use contour() and plot arrays whose elements may be 
> nan?
>
> Thanks,
> Paul

Paul:  Your test script works for me (numpy 1.0, matplotlib 0.87.7, 
python2.5 on macos x).

-Jeff

-- 
Jeffrey S. Whitaker         Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1        FAX   : (303)497-6449
325 Broadway                Boulder, CO, USA 80305-3328


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to