为了使用 cartopy 在子图中保持颜色条方面,我在我的图中插入了新轴(add_axes),但另外,我需要更改刻度标签颜色条和粗体的大小。但是 tick_params 和 set_yticklabels 在新轴上不起作用。
# pos x, pos y, size x, size y
cb_ax = fig.add_axes([0.91, 0.302, 0.015, 0.383])
bar = fig.colorbar(img, cax=cb_ax, extend='max',
shrink=0.8, pad=0.0, spacing='uniform',
orientation='vertical', ticks=clevs,
extendfrac='auto')
bar.set_label(label=f'(mm)', size=10, weight='bold')
# not working
# bar.tick_params(labelsize=10)
# not working
# bar.img.set_yticklabels(clevs, fontsize=9, weight='bold')
完整代码:https ://pastebin.com/NfiMWf2n
绘图结果:https ://1drv.ms/u/s!Amb6LUmV4LnKi55gRf6DqGDKjfTGxA?e=HCGeZb