Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: adjust_bbox should not modify layout engine#24971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
6e4153c
toe93b150
Comparee93b150
to3c28528
Compare@@ -532,6 +532,13 @@ def test_savefig_pixel_ratio(backend): | |||
assert ratio1 == ratio2 | |||
def test_savefig_preserve_layout_engine(tmp_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Onmain
this test throws anAttributeError
because the layout engine got set toNone
. If we set the rcParam then we would get an assertion error onmain
. I'm happy to test either or both.
Thanks for tracking this down@rcomer ! Great detective work.... |
…971-on-v3.7.xBackport PR#24971 on branch v3.7.x (FIX: adjust_bbox should not modify layout engine)
Uh oh!
There was an error while loading.Please reload this page.
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 in018c5ef
Since
restore_bbox
gets 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
pytest
passes)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.rst
ornext_api_changes/README.rst