Description
Bug report
Bug summary
There doesn't appear a way to move colorbars up and down when using colorbar.make_axes()
in constrained_layout=True
mode. The anchor
argument appears to be functionally ignored. (Note that location
specifies left/right/top/bottom, whereas anchor
should move the colorbar within the specified location, eg if the default location of right is chosen, anchor allows moving the colorbar to the top or bottom.)
This appears to be an incomplete implementation of the constrained_layout.layoutcolorbargridspec
function, called from here:
Please let me know if I'm missing something or if there's a workaround.
Code for reproduction
fig, ax = plt.subplots(constrained_layout=True)
ax.scatter(np.arange(100), np.arange(100), c=np.arange(100))
cax, _ = matplotlib.colorbar.make_axes(ax, shrink=0.5, anchor=(0.0, 1.0))
cbar = matplotlib.colorbar.ColorbarBase(cax)
Actual outcome
Expected outcome
With constrained_layout=True
, the anchor argument is honored:
(Note that the colorbar has moved to the top, as expected given the anchor=(0, 1.0)
.)