通过nc文件进行海洋绘图时,由于数据间隔较大(-10,10),但是大部分数据集中在(-1,1),甚至是(-0.1,0.1)的范围内,需要做出如下图所示的colorbar,希望大佬们支支招。另附作图代码。
fig = plt.figure(figsize=(20, 60),dpi=450)
ax = plt.axes(projection=ccrs.Robinson(central_longitude=-150))
ax.set_global()
land = cfeature.NaturalEarthFeature('physical', 'land', '110m', edgecolor='face',
facecolor=cfeature.COLORS['land'])
ax.add_feature(land, facecolor='0.95')
ax.coastlines('110m')
ax.gridlines(color='gray',linestyle='--',linewidth=1)
Dfig=ax.contourf(lons,lats,D,cmap='coolwarm',transform=ccrs.PlateCarree(),levels=np.arange(-10,10,0.2))
相似问题