Open
Description
Bug summary
pyplot.Figure.add_axes
does not seem to respect the transform argument.
Edit: This might already exist for a while: #8986
Code for reproduction
from matplotlib import pyplot as plt
fig, axs = plt.subplots( nrows=2, sharex=True )
# left, bottom, width, height
fig.add_axes([.5, .5, .1, .1], transform=axs[1].transAxes)
fig.tight_layout()
Actual outcome
Expected outcome
I found this workaround in the above-mentioned issue.
import matplotlib
box = matplotlib.transforms.Bbox.from_bounds(.5, .5, .1, .1)
fig.add_axes(fig.transFigure.inverted().transform_bbox( axs[1].transAxes.transform_bbox(box)))
Additional information
No response
Operating system
Arch
Matplotlib Version
3.6.1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
Python 3.10.7
Jupyter version
Jupyter Lab v. 3.4.5
Installation
pip