Python colorbar中的裁剪扩展标记
在使用Python colorbar中的裁剪扩展标记,python,python-3.x,matplotlib,colorbar,contourf,Python,Python 3.x,Matplotlib,Colorbar,Contourf,在使用tourtf时,我必须使用extend='min',将低于给定范围的值(负值)着色。我想问一下如何裁剪这个扩展标记(箭头所指) 把它做成这样 谢谢您可以使用以下代码: bounds = [5*i for i in range(13)] cax = fig.add_axes([.918, 0.175, 0.045, 0.6]) fig.colorbar(mpl.cm.ScalarMappable(cmap = 'Spectral', norm = norm),
tourtf
时,我必须使用extend='min'
,将低于给定范围的值(负值)着色。我想问一下如何裁剪这个扩展标记(箭头所指)
把它做成这样
谢谢您可以使用以下代码:
bounds = [5*i for i in range(13)]
cax = fig.add_axes([.918, 0.175, 0.045, 0.6])
fig.colorbar(mpl.cm.ScalarMappable(cmap = 'Spectral', norm = norm),
cax = cax,
ticks = bounds,
boundaries = [0] + bounds[1:-1] + [60])
bounds = [5*i for i in range(13)]
cax = fig.add_axes([.918, 0.175, 0.045, 0.6])
fig.colorbar(mpl.cm.ScalarMappable(cmap = 'Spectral', norm = norm),
cax = cax,
ticks = bounds,
boundaries = [0] + bounds[1:-1] + [60])