Open
Description
Bug summary
When adding multiple colorbars with plt.colorbar
to different subplots and then removing them again, the removal affects the width of the other subplot.
Code for reproduction
fig, ax = plt.subplots(2)
s = ax[0].scatter([0, 1, 2], [0, 1, 2], c=[0, 1, 2])
plt.colorbar(s, ax=ax[0])
cbar = plt.colorbar(s, ax=ax[1])
cbar.remove()
Actual outcome
Expected outcome
Additional information
This bug occurs with matplotlib>=3.4.0, matplotlib 3.3.4 produces the picture shown under "expected outcome", which is what I would assume is correct.
Operating system
macOS 11.0.1 and Ubuntu 18.04
Matplotlib Version
matplotlib 3.5.2
Matplotlib Backend
module://ipykernel.pylab.backend_inline
Python version
3.8.5
Jupyter version
4.6.3
Installation
pip