-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Use subplots() instead of axes_grid in suitable examples. #10127
Conversation
In simple_annotate01, the subplots order was swapped to allow the "connectionstyle=arc3" label to overflow without being cut off.
f7eb377
to
ac964b5
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.
Big 👍 for this
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 think either comment is a blocker, and I'm all for reducing AxesGrid in the docs, but these examples don't look like the old ones. Is that OK? I think I'm OK w/ it, but wanted to point it out.
|
||
|
||
fig, axs = plt.subplots(2, 2) |
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.
Did you change the shape on purpose? I don't really mind, but the original was 1x4...
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.
Then you'd need to set a figsize (otherwise the subplots are really small), and it just works as well without it after reshaping to (2, 2). Basically, trying to concentrate the example on the relevant points.
(the connectionstyle example does set the figsize because I don't think it can really be made to work nicely without it).
@@ -8,61 +8,38 @@ | |||
import matplotlib.pyplot as plt | |||
import matplotlib.patches as mpatches | |||
|
|||
|
|||
fig, axs = plt.subplots(2, 4) |
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.
Again, I don't mind it, but this one is pretty different from the old version.
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.
The previous example had a bunch of empty, useless subplots.
The reason for reordering the subplots is explained above, but again it's just so that "connectionstyle=arc3" doesn't get overwritten by the next subplot.
Thanks @anntzer |
Backport PR #10127 on branch v2.1.x
PR Summary
These are examples where subplots() is just as good as axes_grid to set up the axes.
In simple_annotate01, the subplots order was swapped to allow the
"connectionstyle=arc3" label to overflow without being cut off.
For reference, compare
https://matplotlib.org/gallery/userdemo/annotate_explain.html#sphx-glr-gallery-userdemo-annotate-explain-py
https://matplotlib.org/gallery/userdemo/simple_annotate01.html#sphx-glr-gallery-userdemo-simple-annotate01-py
https://matplotlib.org/gallery/userdemo/connectionstyle_demo.html#sphx-glr-gallery-userdemo-connectionstyle-demo-py
and
https://955-7439715-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/gallery/userdemo/annotate_explain.html#sphx-glr-gallery-userdemo-annotate-explain-py
https://955-7439715-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/gallery/userdemo/simple_annotate01.html#sphx-glr-gallery-userdemo-simple-annotate01-py
https://955-7439715-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/gallery/userdemo/connectionstyle_demo.html#sphx-glr-gallery-userdemo-connectionstyle-demo-py
PR Checklist