Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Should constrained_layout be applied every draw? #11630

Closed
Labels
topic: geometry managerLayoutEngine, Constrained layout, Tight layout
@jklymak

Description

@jklymak

Discussion

Right nowfig, ax = plt.subplots(constrained_layout=True) will cause the axes resizing to be carried out every draw event; hence the axes get repositioned if the figure changes size, or if zoom is applied, or panning, etc.

Is this desirable?

plt.tight_layout() is only called once, and does not get activated at draw time.

Pros:

  • if the window is resized, the axes positions are recalculated. That means the padding and margins expand or contract as the window gets smaller or larger.
  • if we zoom, and the ticklabels get much longer (i.e. more decimal places), the axes get resized.

Cons:

  • under zoom the axes keep changing size. That can be distracting. It doesn't always work either because there is a strange interaction with zoom and clipping boxes for artists.
  • for a plot w/ lots of axes it makes zooming/panning less responsive.

Any opinions? For my usual workflow, I'm probably fine with just calling constrained layout on the original plot. Any zooming etc are done on working plots versus final presentation plots, and I hard code limits in after the exploration stage. But I get the feeling some people use a lot of GUI work before saving their plots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: geometry managerLayoutEngine, Constrained layout, Tight layout

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp