Closed
Description
Bug summary
colorbar
seems to ignore the keyword setting panchor=False
Code for reproduction
import matplotlib
print('mpl version:', matplotlib.__version__)
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(5, 8))
ax = fig.add_subplot(1, 1, 1, aspect=0.5, anchor="N")
a = np.arange(12)[:,np.newaxis] * np.ones(8)
levels = np.arange(1.5, 10, 2)
plt.contourf(a, cmap='RdYlBu', levels=levels, extend='both')
print('anchor before colorbar:', ax.get_anchor())
plt.colorbar(orientation='horizontal', panchor=False)
print('anchor after colorbar:', ax.get_anchor())
Actual outcome
mpl version: 3.6.0.dev2341+g3df958c760
anchor before colorbar: N
anchor after colorbar: (0.5, 0.0)
Expected outcome
My reading of the docs is that the axes anchor should still be "N" after I add the colorbar. Though given #18752, it's possible I have misunderstood!
panchor(float, float), or False, optional
The anchor point of the colorbar parent axes. If False, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.
Additional information
No response
Operating system
No response
Matplotlib Version
main
branch (3.6.0.dev2341+g3df958c760), 3.5.2 and some older (3.3+) versions.
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response