FIX: adjust_bbox should not modify layout engine#24971
Merged
tacaswell merged 1 commit intomatplotlib:mainfrom Jan 13, 2023
Merged
FIX: adjust_bbox should not modify layout engine#24971tacaswell merged 1 commit intomatplotlib:mainfrom
tacaswell merged 1 commit intomatplotlib:mainfrom
Conversation
6e4153c to
e93b150
Compare
e93b150 to
3c28528
Compare
jklymak
reviewed
Jan 13, 2023
| assert ratio1 == ratio2 | ||
|
|
||
|
|
||
| def test_savefig_preserve_layout_engine(tmp_path): |
Member
There was a problem hiding this comment.
This worked before didn't it? It was when the rcParam was set that the problem was? Or was the layout still getting set to None, and then falling back to the rcParam?
Otherwise if this works, I'm all for it! I do wish all the context switching were simpler to debug, but...
Member
Author
There was a problem hiding this comment.
On main this test throws an AttributeError because the layout engine got set to None. If we set the rcParam then we would get an assertion error on main. I'm happy to test either or both.
jklymak
approved these changes
Jan 13, 2023
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Jan 13, 2023
Member
|
Thanks for tracking this down @rcomer ! Great detective work.... |
Member
Author
oscargus
added a commit
that referenced
this pull request
Jan 13, 2023
…971-on-v3.7.x Backport PR #24971 on branch v3.7.x (FIX: adjust_bbox should not modify layout engine)
1 task
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
Fixes #24954 (I think!) I don't claim to fully understand everything that's going on here, but it seems to me that these lines are doing the same job as
matplotlib/lib/matplotlib/backend_bases.py
Lines 2356 to 2357 in 018c5ef
Since
restore_bboxgets called within the above context manager, the final result is the layout engine continues to be what was set withfig.set_layout_engine(None).PR Checklist
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst