[Tutor] Overlay Quiver Plot on Contours
Felisha Lawrence
felisha.lawrence at gmail.com
Tue Jan 27 00:24:41 CET 2015
Hello,
I have the following script:
import netCDF4
import numpy as np
import matplotlib.pyplot as plt
import pylab
ncfile = netCDF4.Dataset('30JUNE2012_0300UTC.cdf', 'r')
dbZ = ncfile.variables['MAXDBZF']
data = dbZ[0,0]
data.shape
x = np.array([0,10,11])
y = np.array([0,15,16])
X,Y = np.meshgrid(x,y)
u = 5*X
v = 5*Y
plt.figure()
plt.rcParams['figure.figsize'] = (12.0,8.0)
c = plt.contourf(data, 20, cmap='jet')
plt.hold(True)
q = plt.quiver(X,Y,u,v,angles='xy',scale=1000,color='r')
p = plt.quiverkey(q,1,16.5,50,"50 m/s",coordinates='data',color='r')
plt.colorbar()
plt.show()
and I am getting this error:
TypeError: You must first set_array for mappable
Can anyone provide guidance on how you overlay quiver plots on top of
contours?
Please and thanks
Felisha Lawrence
--
Felisha Lawrence
Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student
NASA URC/BCCSO Graduate Fellow
NOAA NCAS Graduate Fellow
Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer
(240)-535-6665 (cell)
felisha.lawrence at gmail.com (email)
More information about the Tutor
mailing list