Defining coordinates for contour plot

Hello,

I’m trying to make a contour plot and I’m running into problems when specifying the coordinates for the plot. I do,

#Specify coordinates of the surface

delta0=1.0

delta1=0.1

x=np.arange(0.0, 6.0, delta0)

y=np.arange(-1.0,3.0, delta1)

#Contour the arrays.

plt.contour(x, y, O3, O3Level)

And I get an error that says,

"TypeError: Length of x must be number of columns in z,

and length of y must be number of rows."

I don’t understand how I’m supposed to get the coordinates for the plot that I want and make x and y the same shape as z. Any suggestions?

Thanks,

Alexa

Hello,

I'm trying to make a contour plot and I'm running into problems when
specifying the coordinates for the plot. I do,

#Specify coordinates of the surface
delta0=1.0
delta1=0.1
x=np.arange(0.0, 6.0, delta0)
y=np.arange(-1.0,3.0, delta1)

#Contour the arrays.
plt.contour(x, y, O3, O3Level)

And I get an error that says,

"TypeError: Length of x must be number of columns in z,
and length of y must be number of rows."

I don't understand how I'm supposed to get the coordinates for the plot
that I want and make x and y the same shape as z. Any suggestions?

Contouring requires data on a grid, so your O3 needs to be a 2-D array of z values, and your x and y need to specify the x and y locations of *those* z values. The orientation is such that the first dimension of the z array corresponds to y, and the second corresponds to x.

Eric

···

On 08/20/2011 02:03 AM, Alexa Villaume wrote:

Thanks,
Alexa

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users