-----------------open a figure
fig = plt.figure(figsize=(10,8.6))
ax = fig.add_subplot(111)
-----------------draw a map
m = Basemap(projection='cyl',llcrnrlat=24,llcrnrlon=108,urcrnrlat=30.5,urcrnrlon=115)
m.readshapefile('/Users/DengJ/Uranus/Software/NCL/map/Hunan_Province','Hunan_Province.shp',linewidth=1,color='k')
m.readshapefile(mappath+'BOUNT_line','BOUNT_line.shp',color='k')
lons,lats = np.meshgrid(lon,lat)
xi,yi = m(lons,lats)
------------------set data range and plot
v = np.arange(0.,1.2,0.2)
p = m.contourf(xi,yi,aod_mean,v,norm=colors.Normalize(vmin=0,vmax=1))
m.drawparallels(np.arange(24,31,1),labels=[1,0,0,0],fontsize=20)
m.drawmeridians(np.arange(107,117,1.),labels=[0,0,0,1],fontsize=20)
m.drawcoastlines()
m.drawstates()
m.drawcounties()
-----------------add a colorbar
cbar = m.colorbar(p,location="bottom",pad="5%",ticks=v,size="3%")
cbar.ax.set_xlabel('AOD from Modis Terra')
-----------------clip intrerest region
clip = maskout.shp2clip(p,ax,mappath+'Hunan_Province',584)
----------------Set label font
plt.tick_params(axis='both',labelsize=20.,color='gold')
-------------------- axis sets
ax.spines['bottom'].set_linewidth(2)
ax.spines['left'].set_linewidth(2)
ax.spines['right'].set_linewidth(2)
ax.spines['top'].set_linewidth(2)
plt.show()
image.png
网友评论