forgot "reply to all"
--- Begin Message --- The problem is that support for 1-D x and y inputs was added to a later version of mpl than what you have. The workaround is easy:

X, Y = meshgrid(x,y)
pcolor(X, Y, z)

Eric

Park Hays wrote:
Eric,

Python 2.5 (precompiled binary)
SciPy 0.5.2 (precompiled binary)
matplotlib 0.8737 (win32-py2.5 precompiled binary)
and if it matters I'm running in iPython for all this work.

The script is:
----
from scipy import *
from pylab import *
import matplotlib.numerix.ma <http://matplotlib.numerix.ma> as ma

N = 10
y = linspace(0, pi, N)
x = linspace(0, pi, N)
z = randn( N, N)
zm = ma.masked_where( z > 0.3, z)

pcolor( x, y, zm)

----

and the result I get is:

----
In [11]: execfile('pcolor_issue.py')
---------------------------------------------------------------------------
<type 'exceptions.ValueError'>            Traceback (most recent call last)

C:\Documents and Settings\phays\My Documents\NDS\PDOP\<ipython console> in <module>()

C:\Documents and Settings\phays\My Documents\NDS\PDOP\pcolor_issue.py in <module>()
      7 x = linspace(0, pi, N)
      8 z = randn( N, N)
      9 zm = ma.masked_where( z > 0.3, z)
     10
---> 11 pcolor( x, y, z)

C:\apps\py\lib\site-packages\matplotlib\pylab.py in pcolor(*args, **kwargs)
   1941         hold(h)
   1942     try:
-> 1943         ret =  gca().pcolor(*args, **kwargs)
   1944         draw_if_interactive()
   1945     except:

C:\apps\py\lib\site-packages\matplotlib\axes.py in pcolor(self, *args, **kwargs)

3788 raise TypeError, 'Illegal arguments to pcolor; see help(pcolor)'
   3789
-> 3790         Nx, Ny = X.shape
   3791
   3792         # convert to MA, if necessary.

<type ' exceptions.ValueError'>: need more than 1 value to unpack
----
\\endor.nds\users\phays\memos\bdye_pxlConfTab\BDYEPixelConfigTableDescription_v00.doc

On 3/29/07, * Eric Firing* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Pcolor accepts non-integer values of X and Y, so I don't know what the
    problem is.  Please post a minimal but complete script that illustrates
    the error, and say what version of mpl you are using. With moderately
    recent versions, using masked arrays should work fine.

    Eric

    Park Hays wrote:
     > I have bogus values I don't want to display in a gridded data set
     > (regions of non-convergence, for example).  pcolor does exactly
    what I
     > want with a masked array, except the X and Y arguments must be
    integer
     > arrays (as far as I can tell) and my data X and Y points are not
    integer
     > arrays.  An approximation of what is happening goes like:
     >
     > x = linspace( 0, pi, 100)
     > y = linspace( -pi/2, pi/2, 30)
     > ev = custom_func( x, y)
     > print sum( isnan( ev))
     >  12 (or whatever)
     >
     > ev_m = ma.mask_where( isnan( ev), ev)
     > pcolor( x, y, ev_m) <-- this will fail, with an error like "need more
     > than one value to unpack" which I think is caused by the non-integer
     > nature of x, y.
     >
     >
     > Any suggestions for how can I can address this?  My preference is
    to use
     > pcolor, because of the  transparency.  I am not a fan of the scipy
     > discussion regarding user-driven normalization "sentinels" to
    catch the
     > bogus values.  Masked arrays seem so much more flexible.
     >
     > -Park
     >
     >





--- End Message ---
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to