-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Changes to figure.clf() and suplot_adjust #11086
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
Changes to figure.clf() and suplot_adjust #11086
Conversation
d2289c9
to
54d5e19
Compare
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.
Thanks a lot, I think this looks good. But the new behaviour is a breaking change, so it needs an API change note (matplotlib/doc/api/next_api_changes/
). You also have some PEP8 errors (see the CI that fails).
lib/matplotlib/figure.py
Outdated
Set *keep_observers* to True if, for example, | ||
a gui widget is tracking the axes in the figure. | ||
Parameters | ||
--------- |
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.
Missed underline...
2a96fc9
to
1afff75
Compare
1afff75
to
541f151
Compare
@@ -173,77 +173,81 @@ def __init__(self, left=None, bottom=None, right=None, top=None, | |||
wspace=None, hspace=None): | |||
""" | |||
All dimensions are fractions of the figure width or height. | |||
Defaults are given by :rc:`figure.subplot.[name]`. | |||
Defaults are given by :rc:`figure.subplot.*`. |
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.
would leave [name]
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 don't really like any of them but I don't know a better one. I think that figure.subplot.[name]
make it easier to understand what to write.
I think a simpler API would be to have
|
A dict would be good but I don't think that that API are very good. |
541f151
to
de2f714
Compare
I made a small change so that the test passed again. |
@fredrik-1 sorry this fell off our radar - be sure to ping us if you pick it up again and you want it reviewed. |
I'm going to close as abandoned, but feel free to re-open if wanted. Thanks for the help @fredrik-1 |
I wrote some code to solve #11059
figure.clf()
now sets the subplots parameters to their default values. This is a behavior that I have missed before and I think that it is the correct thing to do.rc_default
is added to subplots_adjust to make it simpler to get back to default values when tuning the subplot parametersSubplotParams
object has got a__repr__
function with the important attributes such that it is easier to see and print what the subplot parameters areSubplotParams
object has got a get function to make it easier to get its parametersSubplotParams.update
has been written more compactI think that these changes make it easier to work with and understand the subplot parameters without changing the interface to much.
PR Checklist