-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: add get_gridspec convenience method to subplots #11438
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
Conversation
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 simplifies many cases where otherwise each axes would need to be created from a GridSpec individually.
There is indeed also no harm in introducing this as it only gives a shortcut to already present (but somehow hidden) methods.
Approved, but would like to see a proper documentation (possibly in a follow up PR), best within the gridspec tutorial.
Yes, will definitely include an example and gridspec tutorial edit.... Just wanted to make sure the proposed change had enough support before going nuts... |
OK, this now has documentation (example + tutorial edit). |
c84db54
to
4983637
Compare
----------------------------------------- | ||
|
||
New method `.SubplotBase.get_gridspec` is added so that users can | ||
easily get the gridspec that went into making as axes: |
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.
as -> an
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.
modulo a typo in whats new
4983637
to
101b34e
Compare
This needs a second review to merge, It’s a one-liner plus docs... |
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.
You're having three times almost the same example, onces in "What's new", once within the gridspec tutorial once as a separate example. Is this duplication reasonable?
================================================== | ||
|
||
Sometimes we want to combine two subplots in an axes layout created with | ||
`.figure.subplots`. We can get the `.gridspec.Gridspec` from the axes |
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.
Links do not resolve. Possibly use ~.Figure.subplots
and ~.gridspec.GridSpec
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!. I'll fix the links.
The whats new is kind of ephemeral.
My understanding is that there are two types of people in the matplotlib community (that actually read the docs): those that read the examples, and those that read the tutorials. Indeed a lot of the examples are historically just sections from some tutorials. I don't think the duplication is egregious, but happy to remove any/all if that is what folks want.
101b34e
to
d2a1456
Compare
Recycling for CI |
Merging on a combination of @ImportanceOfBeingErnest 's review and reading it a second time forgetting I had already approved this PR and went to approve it again. |
The failure was wx on osx |
PR Summary
As per #11434 its a bit of a pain to get the gridspec after calling
plt.subplots()
. This change lets you do the following, where the only really change is that we don't have to do the more cumbersomegs = ax.get_suplotspec().get_gridspec()
. Much more discoverable.To do: Add to gridspec tutorial which I'll d if this is in general OK. I don't see the harm in adding this.PR Checklist