FIX: do not warn when calling tight_layout multiple times#26300
Merged
jklymak merged 1 commit intomatplotlib:mainfrom Jul 13, 2023
Merged
FIX: do not warn when calling tight_layout multiple times#26300jklymak merged 1 commit intomatplotlib:mainfrom
jklymak merged 1 commit intomatplotlib:mainfrom
Conversation
Member
|
Would it be enough to not warn when the existing layout engine is any placeholder layout engine? My understanding is that the warning is aimed at users who set up a figure with compressed/constrained layout and do not realise If you have a placeholder, I think you must already have turned the layout engine off somewhere. |
Member
Author
|
I was worried about the case of fig = plt.figure(layout='constrained')
fig.set_layout_engine('none')
fig.tight_layout() # <- should this warn?!I went with "yes" on reflex but on a bit more consideration, I think "no" may be a better answer as by explicitly clearing the layout engine the user as already opted out of the automatic calls and are doing it "manually". |
18e19b3 to
f7574a4
Compare
rcomer
approved these changes
Jul 13, 2023
jklymak
approved these changes
Jul 13, 2023
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Jul 13, 2023
…out multiple times
tacaswell
added a commit
that referenced
this pull request
Jul 13, 2023
…300-on-v3.7.x Backport PR #26300 on branch v3.7.x (FIX: do not warn when calling tight_layout multiple times)
6 tasks
wavebyrd
pushed a commit
to wavebyrd/matplotlib
that referenced
this pull request
Mar 13, 2026
…out multiple times
wavebyrd
pushed a commit
to wavebyrd/matplotlib
that referenced
this pull request
Mar 13, 2026
…t-of-pr-26300-on-v3.7.x Backport PR matplotlib#26300 on branch v3.7.x (FIX: do not warn when calling tight_layout multiple times)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
Closes #26290
I was between adding state to the PlaceHolder layout enigne and holding that state via a no-op sub-class. Ended up going for the second, but could see the case for the first.
PR checklist