njs
2015-02-18 19:52:16 UTC
Hi All,
I'm having issues with quiver, and quiverkey() although, I have never
experienced these issues in the past. I attached an image to this post that
demonstrates that quiver_key() used to work for me, this image was generated
on 17-Jul-2014. However, if I run this exact same code (see below for the
code), the quiver key reference on the top right does not get plotted, but
the text will. I haven't changed anything, but I think there have been some
package updates between then and now. For what it's worth, I've tried many
different ways to generate the quiverkey() and haven't had any luck. Has
anyone else experienced similar issues?
Thanks for any insights!
Working quiverkey():
<Loading Image...>
quiverkey() doesn't work anymore...:
<Loading Image...>
Code:
fig = plt.figure(figsize=(12,12))
map = Basemap(projection = 'cyl', llcrnrlat = -30, urcrnrlat = 90, \
llcrnrlon = 0, urcrnrlon = 360, resolution = 'c')
[x,y] = N.meshgrid(lons,lats)
[x,y] = map(x,y)
[xulr,yulr] = N.meshgrid(lons1,lats1)
[xulr,yulr] = map(xulr,yulr)
clevs = N.arange(-50,51,5)
cs = map.contourf(x,y,hgt500aComp[lag,:,:],cmap='RdBu_r',
levels = clevs)
cs1 = map.contour(x,y,hgt500Comp[lag,:,:],N.arange(1110,1230,6), \
colors='purple',linewidth=100,linestyle = 'dashed')
cs1 = map.contour(x,y,hgt500aComp[lag,:,:],levels = clevs,
colors = 'black')
colors=[(244,2,255),(36,26,232),(255,255,255),(8,232,61),(224,255,0)]
cmap = mF.make_cmap(colors, position=None, bit=True)
clevs = N.arange(-30,30.025,.025)
cs2 = map.contourf(xulr,yulr,olrComp[lag,:,:],cmap=cmap,
levels = clevs)
Q = map.quiver(x[::2,::2],y[::2,::2],u850Comp[lag,::2,::2],
v850Comp[lag,::2,::2],width = 0.002,scale = 50)
map.drawcoastlines(linewidth = 1)
map.drawcountries(linewidth = 0.5)
map.fillcontinents(zorder = 0)
map.drawmeridians(N.arange(0,360,30))
map.drawparallels(N.arange(-90,90,30))
title = plt.title('Lag: {0} | Transition Cases | n =
{1}'.format(lag-30,len(cases)))
title.set_fontweight('bold')
axt = fig.add_axes([.15,.35,.3,.01])
cbar = plt.colorbar(cs,cax = axt,orientation = 'horizontal')
cbar.set_label('500-hPa Anomaly (m)')
cbar.set_ticks(N.arange(-50,51,25))
cs1.clabel(fmt = '%d')
axt = fig.add_axes([.58,.35,.3,.01])
cbar2 = plt.colorbar(cs2,cax = axt,orientation = 'horizontal')
cbar2.set_label(r'OLR Anomaly ($W m^{-2}$)')
cbar2.set_ticks(N.arange(-30,31,10))
qk = plt.quiverkey(Q,0.95,1.05,1.0,r'1 $m s^{-1}$',labelpos='E')
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/quiverkey-doesn-t-plot-the-reference-vector-tp44968.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
I'm having issues with quiver, and quiverkey() although, I have never
experienced these issues in the past. I attached an image to this post that
demonstrates that quiver_key() used to work for me, this image was generated
on 17-Jul-2014. However, if I run this exact same code (see below for the
code), the quiver key reference on the top right does not get plotted, but
the text will. I haven't changed anything, but I think there have been some
package updates between then and now. For what it's worth, I've tried many
different ways to generate the quiverkey() and haven't had any luck. Has
anyone else experienced similar issues?
Thanks for any insights!
Working quiverkey():
<Loading Image...>
quiverkey() doesn't work anymore...:
<Loading Image...>
Code:
fig = plt.figure(figsize=(12,12))
map = Basemap(projection = 'cyl', llcrnrlat = -30, urcrnrlat = 90, \
llcrnrlon = 0, urcrnrlon = 360, resolution = 'c')
[x,y] = N.meshgrid(lons,lats)
[x,y] = map(x,y)
[xulr,yulr] = N.meshgrid(lons1,lats1)
[xulr,yulr] = map(xulr,yulr)
clevs = N.arange(-50,51,5)
cs = map.contourf(x,y,hgt500aComp[lag,:,:],cmap='RdBu_r',
levels = clevs)
cs1 = map.contour(x,y,hgt500Comp[lag,:,:],N.arange(1110,1230,6), \
colors='purple',linewidth=100,linestyle = 'dashed')
cs1 = map.contour(x,y,hgt500aComp[lag,:,:],levels = clevs,
colors = 'black')
colors=[(244,2,255),(36,26,232),(255,255,255),(8,232,61),(224,255,0)]
cmap = mF.make_cmap(colors, position=None, bit=True)
clevs = N.arange(-30,30.025,.025)
cs2 = map.contourf(xulr,yulr,olrComp[lag,:,:],cmap=cmap,
levels = clevs)
Q = map.quiver(x[::2,::2],y[::2,::2],u850Comp[lag,::2,::2],
v850Comp[lag,::2,::2],width = 0.002,scale = 50)
map.drawcoastlines(linewidth = 1)
map.drawcountries(linewidth = 0.5)
map.fillcontinents(zorder = 0)
map.drawmeridians(N.arange(0,360,30))
map.drawparallels(N.arange(-90,90,30))
title = plt.title('Lag: {0} | Transition Cases | n =
{1}'.format(lag-30,len(cases)))
title.set_fontweight('bold')
axt = fig.add_axes([.15,.35,.3,.01])
cbar = plt.colorbar(cs,cax = axt,orientation = 'horizontal')
cbar.set_label('500-hPa Anomaly (m)')
cbar.set_ticks(N.arange(-50,51,25))
cs1.clabel(fmt = '%d')
axt = fig.add_axes([.58,.35,.3,.01])
cbar2 = plt.colorbar(cs2,cax = axt,orientation = 'horizontal')
cbar2.set_label(r'OLR Anomaly ($W m^{-2}$)')
cbar2.set_ticks(N.arange(-30,31,10))
qk = plt.quiverkey(Q,0.95,1.05,1.0,r'1 $m s^{-1}$',labelpos='E')
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/quiverkey-doesn-t-plot-the-reference-vector-tp44968.html
Sent from the matplotlib - users mailing list archive at Nabble.com.