contour question

It's a bug in the contour function.

In, in function 'contour', put the line

y, x = indices((jmax,imax), 'd')

in a condition, for example:

if x == None and y == None:
    y, x = indices((jmax,imax), 'd')

A permanent fix will go in CVS next week.

Nadia Dencheva

Date: Sat, 01 Jan 2005 08:05:12 -0700
From: Jeff Whitaker <jswhit@...146...>
Subject: [Matplotlib-users] contour question
To: "'matplotlib-users'" <>

Hi all:

I was experimenting with the contour demo and discovered that

the x and

y keyword arguments don't behave like I expect them to (i.e.

they don't

behave as they do in pcolor).

For example:

from pylab import *
delta = 0.025
x = y = arange(-3.0, 3.0, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
#levels, colls = contour(Z2-Z1, x=X,y=Y,levels=6,
# linewidths=arange(.5, 4, .5),
# colors=('r', 'green', 'blue', (1,1,0),
'#afeeee', 0.5),
# origin='lower')

plots the data with the x and y axes going from -3 to +3.


the contour call, the axes then are the same as the

dimensions of the Z

array, regardless of whether the x=X, y=Y keyword args are

given. In

other words, contour seems to ignore the x,y keywords. Am I




Jeffrey S. Whitaker Phone : (30the3)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web :
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition t-shirt from


It's fun and FREE -- well,



---- Original message ----

Matplotlib-users mailing list