Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: tight_layout doesn't work with fixed aspect Axes #21009

Copy link
Copy link
Open
@dstansby

Description

@dstansby
Issue body actions

Bug summary

tight_layout() tries to set the x/y subplot parameters independently. When using a fixed-aspect Axes, this has issues because the x/y extents of the Axes cannot be independently set.

This is the root cause of #4251, with a much simpler example below. Also possibly a duplicate of #18313, but I thought it was worth a new issue as this one has a much simpler example.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.set_aspect('equal')
ax.set_ylabel('really really really really long label', rotation=0, horizontalalignment='right')

fig.tight_layout()
plt.show()

Actual outcome

Figure_1

Expected outcome

The long axis label is contained within the figure.

Operating system

macOS

Matplotlib Version

3.4.2.post1853+gdce40267b5.d20210907

Matplotlib Backend

MacOSX

Python version

3.9.6

Jupyter version

No response

Other libraries

No response

Installation

source

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: geometry managerLayoutEngine, Constrained layout, Tight layoutLayoutEngine, Constrained layout, Tight layout

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.