The following program seems to work with contour/contourf. However the documentation for the contourf function states
contour(X,Y,Z)
“X, Y, and Z must be arrays with the same dimensions.”
I am finding that contour works if the dimension of X and Y are 1, but Z must be two-dimensional. The following program seems to bear this out. Are the arrays x and y below two-dimensional, or is the documentation misleading? Thanks for your help.
import numpy as N
import pylab as PLT
lons = N.linspace(-5.,5.,5) # Is this a one or two dimensional array?
lats = N.linspace(-3.,3.,4)
z = N.zeros((len(lats), len(lons)))
for i in range(len(lons)):
for j in range(len(lats)):
z[j,i]=i+j
PLT.clf()
PLT.contourf(lons,lats,z)
PLT.colorbar()
PLT.show()
-Tony
···
–
Tony Mannucci
Supervisor, Ionospheric and Atmospheric Remote Sensing Group
Mail-Stop 138-308, Tel > (818) 354-1699
Jet Propulsion Laboratory, Fax > (818) 393-5115
California Institute of Technology, Email > Tony.Mannucci@…369…
4800 Oak Grove Drive, http://genesis.jpl.nasa.gov
Pasadena, CA 91109