目录
- ticks=[10,30,50,70,90,110]
- cf=ax.contourf(olon,olat,PM25,levels=ticks,cmap=cmaps.NCV_bright,transform=ccrs.PlateCarree(),extend='both')
- # 白化contourf
- clip1=maskout.shp2clip(cf,ax,'./henan1')
- cbar=plt.colorbar(cf,shrink=0.96,orientation='vertical',pad=0.01,aspect=35,extend='both')
- font3={'family':'SimHei','size':16,'color':'k'}
- ax1=cbar.ax#召唤出cb的ax属性并省称为ax2,这时ax2即视为一个子图
- cbar.set_ticks([20,40,60,80,100])
- ax1.tick_params(labelsize=16,right=True)#修改刻度样式,并使左右都有刻度
- ax1.set_yticklabels(['小雨','中雨','大雨','暴雨','特大暴雨'],fontdict=font3)
- cbar.ax.tick_params(labelsize=16,direction='in',right=False,labelcolor='blue')
-
- cbar.set_ticks([10,30,50,70,90,110])
- ax1.tick_params(labelsize=16,right=True)#修改刻度样式,并使左右都有刻度
- ax1.set_yticklabels(['小雨','中雨','大雨','暴雨','特大暴雨','超大暴雨'],fontdict=font3)
- cbar.ax.tick_params(labelsize=16,direction='in',right=False,labelcolor='red')
-
- ticks=[10,20,30,40,50,60,70,80,90,100]
- cbar=plt.colorbar(cf,orientation='vertical',pad=0.01,aspect=35,shrink=0.96,ticks=ticks,extend='both')
- #为色标加标注
- font2={'family':'SimHei','size':16,'color':'k'}
- cbar.set_label('频次',fontdict=font2)
- cbar.ax.tick_params(labelsize=16)
- cbar.set_ticks([20,30,40,50,60,70,80,90])
- cbar.set_ticklabels(['20 times','30 times','40 times','50 times','60 times','70 times','80 times','90 times'])
cbar.ax.tick_params(labelsize=16, direction='in',length=18,width=1.6,color='k')
-
- cbar.ax.tick_params(labelsize=16, direction='in', right=False)
cbar.ax.tick_params(labelsize=16, direction='out',length=6,width=2,color='k')
-
- # 以下6条语句是定义地理坐标标签格式
- ax.set_xticks(np.arange(leftlon, rightlon+0.1, 1),crs=ccrs.PlateCarree())
- ax.set_yticks(np.arange(lowerlat, upperlat+0.1, 1),crs=ccrs.PlateCarree())
- lon_formatter = LongitudeFormatter()
- lat_formatter = LatitudeFormatter()
- ax.xaxis.set_major_formatter(lon_formatter)
- ax.yaxis.set_major_formatter(lat_formatter)
- ax.tick_params(color='k', direction='in',length=6,width=2)