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

constrained_layout and texts outside of the axes #19358

Copy link
Copy link
Open
@anntzer

Description

@anntzer
Issue body actions

Bug report

Bug summary

Texts outside of the axes extents interact "interestingly" with constrained_layout.

Code for reproduction

ax = figure(constrained_layout=True).add_subplot(); ax.plot([0, 1]); ax.text(2, 2, "hello")
ax = figure(constrained_layout=True).add_subplot(); ax.plot([0, 1]); ax.text(4, 4, "hello")

Actual outcome

The first example gives
1
the second one
2
together with (only for the second one)

UserWarning: constrained_layout not applied because axes sizes collapsed to zero.  Try making figure larger or axes decorations smaller.

(You can also try to pan the axes and get interesting results in that way.)

Expected outcome

I'm not actually sure how I'd actually want constrained_layout to handle such cases, but the current state seems... shaky.

Matplotlib version

  • Operating system: linux
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): HEAD
  • Matplotlib backend (print(matplotlib.get_backend())): qt5agg
  • Python version: 39
  • Jupyter version (if applicable):
  • Other libraries:

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.