Closed
Description
Bug summary
When setting rcParams['figure.constrained_layout.use'] = True
and ax.set_aspect('equal')
, and saving with bbox_inches = 'tight'
, the resulting figure is cropped incorrectly.
Code for reproduction
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['figure.constrained_layout.use'] = True
fig, ax = plt.subplots()
ax.plot([0, 1])
ax.set_xlim(0, 1)
ax.set_aspect('equal')
fig.savefig('test.png', bbox_inches = 'tight')
Actual outcome
MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.
fig, ax = plt.subplots()
Expected outcome
If I leave out mpl.rcParams['figure.constrained_layout.use'] = True
, but call subplots
with layout = 'constrained'
, the saved figure is as expected:
(The deprecation warning is probably the same is in #23921, and appears in both cases.)
Additional information
No response
Operating system
macOS Monterey
Matplotlib Version
3.6.0
Matplotlib Backend
macOSX
Python version
3.10.6
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels