Closed
Description
Bug report
Bug summary
constrained_layout, fixed aspect axes (e.g. from imshow
), and savefig(bbox_inches="tight") don't play well together.
Code for reproduction
fig = plt.figure(constrained_layout=True)
fig.add_subplot().imshow(np.random.rand(10, 10))
fig.savefig("/tmp/out.png", bbox_inches="tight")
Actual outcome
The axes are cropped, and the aspect=1 is lost (pixels are not square anymore, but slightly elongated).
Expected outcome
Not the above.
Matplotlib version
- Operating system: linux
- Matplotlib version (
import matplotlib; print(matplotlib.__version__)
): HEAD - Matplotlib backend (
print(matplotlib.get_backend())
): agg - Python version: 39
- Jupyter version (if applicable):
- Other libraries: