我正在尝试使用python中的matplotlib / basemap标记正交投影上的平行/经线。根据底图文档,标签不适用于drawparalles(parallels,labeles=[left,right,top,bottom])
命令的拼写和其他一些投影,必须手动完成。任何人都可以建议我手动标记平行/经络的任何方法。
lon2,lat2=m1(lon,lat)
lon3,lat3=m1(lon1,lat1)
cax1=m1.pcolor(lon2,lat2,data1,cmap='jet')
colob=plt.colorbar(fraction=0.05)
colob.set_label(r"Diff. Flux $[cm^{-2}Sr^{-1}s^{-1}]$")
parallels = np.arange(-90,90,15.)
cax4=m1.drawparallels(parallels,labels=[1,0,0,0])
meridian = np.arange(0,360,15.)
cax5=m1.drawmeridians(meridian,labels=[0,0,0,1])
答案 0 :(得分:2)
我找到了使用matplotlib.annotate
命令的解决方案。
lon2,lat2=m1(lon,lat)
lon3,lat3=m1(lon1,lat1)
cax1=m1.pcolor(lon2,lat2,data1,cmap='jet')
colob=plt.colorbar(fraction=0.05)
colob.set_label(r"Diff. Flux $[cm^{-2}Sr^{-1}s^{-1}]$")
parallels = np.arange(-90,90,15.)
cax4=m1.drawparallels(parallels,labels=[1,0,0,0])
meridian = np.arange(0,360,15.)
cax5=m1.drawmeridians(meridian,labels=[0,0,0,1])
for i in np.arange(len(meridian)):
plt.annotate(np.str(meridian[i]),xy=m1(meridian[i],0),xycoords='data')
for i in np.arange(len(parallels)):
plt.annotate(np.str(parallels[i]),xy=m1(180,parallels[i]),xycoords='data')