-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: fix layout pad #25031
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: fix layout pad #25031
Conversation
@@ -76,7 +76,7 @@ def do_constrained_layout(fig, h_pad, w_pad, | |||
Renderer to use. | |||
|
|||
h_pad, w_pad : float | |||
Padding around the axes elements in figure-normalized units. | |||
Padding around the axes elements in inches. |
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.
I think this one was correct, because the layout engine does the normalisation before calling this function
matplotlib/lib/matplotlib/layout_engine.py
Lines 246 to 254 in be7ea76
# pads are relative to the current state of the figure... | |
w_pad = self._params['w_pad'] / width | |
h_pad = self._params['h_pad'] / height | |
return do_constrained_layout(fig, w_pad=w_pad, h_pad=h_pad, | |
wspace=self._params['wspace'], | |
hspace=self._params['hspace'], | |
rect=self._params['rect'], | |
compress=self._compress) |
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.
....oh, thats why its so confused. OK, I'll look into it more carefully.
@@ -203,7 +203,7 @@ def __init__(self, *, h_pad=None, w_pad=None, | |||
Parameters | |||
---------- | |||
h_pad, w_pad : float | |||
Padding around the axes elements in figure-normalized units. | |||
Padding around the axes elements in inches. |
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.
We did this one at #24981
Edit: sorry I just noticed you are targetting this for 3.7. So this one stands 👍
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.
I wasn't being that subtle - I didn't catch that it was done in #24981.
There is also the |
@rcomer So I'm confused what needs to be done here, if anything. Should I just close as already fixed? |
I think it’s already fixed in |
I think this has been wrong long enough to wait for 3.8 ;-) |
PR Summary
The layout pads in the constrained layout docs were incorrectly stated as being in figure-normalized units, whereas they are actually in inches. This was correct in most places, except where it mattered the most.
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