-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
Bug summary
Figure.tight_layout() changes relative placement of axes.
I don't know where this is a bug, a feature request or just unavoidable behavior.
(In this simple case, moving .tight_layout() ahead of .add_axes fixes it.)
Code for reproduction
from matplotlib import pyplot as plt
import matplotlib
fig, axs = plt.subplots( nrows=2, sharex=True )
# left, bottom, width, height
box = matplotlib.transforms.Bbox.from_bounds(.5, 0, .1, .1)
fig.add_axes(fig.transFigure.inverted().transform_bbox( axs[0].transAxes.transform_bbox(box)))
fig.add_axes(fig.transFigure.inverted().transform_bbox( axs[1].transAxes.transform_bbox(box)))
fig.tight_layout()Actual outcome
Expected outcome
Additional information
Related issue: #24225
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
Metadata
Metadata
Assignees
Labels
No labels

