-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update docs of GridSpec #15031
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
Update docs of GridSpec #15031
Conversation
Parameters | ||
---------- | ||
nrows, ncols : int | ||
The number of rows and columns of the grid. | ||
|
||
figure : `~.figure.Figure`, optional | ||
Only used for constrained layout to create a proper layoutbox. |
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 is better than nothing, but still not too helpful.
@jklymak Maybe you have a better description?
@@ -320,7 +321,12 @@ def __setstate__(self, state): | |||
|
|||
def update(self, **kwargs): | |||
""" | |||
Update the current values. | |||
Update the subplot parameters of the grid. |
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'm more specific which values to update.
But, there's also some position updating of some Axes happening, which I don't understand, so I'm still not describing that.
The last sentence
Values set to None use the rcParams value.
seems to be more like "Values set to None revert the parameter to the default (see get_subplot_params
)"?
Unfortunately this behavior is also different from SubplotParams.update.
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 is so much clearer, it's awesome.
|
||
left, right, top, bottom : float, optional | ||
Extent of the subplots as a fraction of figure width or height. | ||
Left cannot be larger than right, and bottom cannot be larger than | ||
top. | ||
top. If not given, the values will be inferred from a figure or | ||
rcParams when necessary. See also `GridSpec.get_subplot_params`. |
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 the when necessary
is extraneous
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.
What I wanted to express with that is that it is a delayed evaluation. In contrast to many other default fallbacks GridSpec.left
stays None. The paradigm seems to be to use get_subplot_params
which will resolve to the given alternatives.
Maybe "at usage time" or something would be better?
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.
at run time or at draw time or when the figure is being rendered? Those are both a bit more jargony than I like but maybe closer to clearer?
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. Chosen "at draw time" in #15106.
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.
Looks good from my side.
PR Summary
Some of the aspects of relation to figures with constrained layout and the
update()
method are not quite clear to me. I've added docs for them as far as I could understand, but that could certainly be improved further. OTOH this is already an improvement as is and could be merged as such.