I am trying to make a plot with a colorbar that has a reduced axis over which the colorbar is executed.
This is set via passing in a norm to contourf:
logNorm = colors.Normalize(vmax=0,vmin=-100)
surf = ax.contourf(X,Y,logZ, map_scale, cmap=cm.jet, norm=logNorm)
The output of this will have the colorbar extend to the full range of the data and not limited by the norm set:
cbar = fig.colorbar(surf, shrink=0.70, aspect=36, fraction=.15,pad=.03)
so I assumed modifying by setting the norm like this would do the trick:
cbar = fig.colorbar(surf, shrink=0.70, aspect=36, fraction=.15,pad=.03, norm=logNorm)
This isn’t what happens. norm has no effect. The norm is recognized but not passed to ColorbarBase is my guess from doing this instead to get the desired effect:
axcb, _ = mpl.colorbar.make_axes_gridspec(ax, shrink=0.7)
cbar = mpl.colorbar.ColorbarBase(axcb, cmap=cm.jet, norm=logNorm)
Is this a bug or any reason why the norm is not passed through if specified in colorbar??