Skip to content

constrained_layout + fixed-aspect axes + bbox_inches="tight" #19339

@anntzer

Description

@anntzer

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

out

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: geometry managerLayoutEngine, Constrained layout, Tight layout

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy