【Python】matplotlib 指定 colorbar 的刻度
【代码】【Python】matplotlib 指定 colorbar 的刻度。
·
比如要将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])
更多推荐
已为社区贡献1条内容
所有评论(0)