Skip to content

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

Merged
merged 1 commit into from
Aug 11, 2019

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Aug 11, 2019

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.

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.
Copy link
Member Author

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.
Copy link
Member Author

@timhoffm timhoffm Aug 11, 2019

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.

Copy link
Member

@story645 story645 left a 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`.
Copy link
Member

@story645 story645 Aug 11, 2019

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

Copy link
Member Author

@timhoffm timhoffm Aug 11, 2019

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?

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest left a 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.

@ImportanceOfBeingErnest ImportanceOfBeingErnest merged commit 5f5525d into matplotlib:master Aug 11, 2019
@QuLogic QuLogic added this to the v3.2.0 milestone Aug 12, 2019
@timhoffm timhoffm deleted the doc-gridspec branch August 22, 2019 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants