FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight · Issue #24133 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight #24133

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

Activity

  1. changed the title [-]Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight[/-] [+][Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight[/+] on Oct 9, 2022
  2. Anupam-USP commented on Oct 14, 2022

    Hey @konradmarx, if this issue is still open can you please help me on getting started with this?

  3. konradmarx commented on Oct 14, 2022

    Author

    Hi, thanks for the answer!
    The issue is still open and also occurs in version 3.6.1 (only the deprecation warning is gone).
    However, if I downgrade to 3.5.2, the issue doesn't occur.

  4. added this to the v3.6.2 milestone on Oct 14, 2022
  5. jklymak commented on Oct 15, 2022

    Member

    Thanks for the report and sorry this broke. It should be fixed in 3.6.2

  6. konradmarx commented on Oct 15, 2022

    Author

    Thanks for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL