比如要将colorbar的刻度设置为0、50、100、150,可以使用set_ticks方法来指定刻度位置:

ax0 = ax1.pcolormesh(X, Y, mapmean, transform=ccrs.PlateCarree(), vmin=0, vmax=150, cmap=cmaps.WhiteBlueGreenYellowRed)
position = fig.add_axes([2.83, 0.24, 0.03, 0.20])
cbar = plt.colorbar(ax0, cax=position, orientation='vertical', extend='both')
cbar.set_ticks([0, 50, 100, 150])
Logo

鸿蒙生态一站式服务平台。

更多推荐