Skip to content
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

Merged
merged 1 commit into from
Dec 29, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 29, 2017

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

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

In simple_annotate01, the subplots order was swapped to allow the
"connectionstyle=arc3" label to overflow without being cut off.
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big 👍 for this

@dstansby dstansby added this to the v2.1.2 milestone Dec 29, 2017
Copy link
Member

@jklymak jklymak left a 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)
Copy link
Member

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...

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

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.

@jklymak jklymak merged commit 884060a into matplotlib:master Dec 29, 2017
@jklymak
Copy link
Member

jklymak commented Dec 29, 2017

Thanks @anntzer

lumberbot-app bot pushed a commit that referenced this pull request Dec 29, 2017
@anntzer anntzer deleted the subplots-examples branch December 29, 2017 20:14
tacaswell added a commit that referenced this pull request Dec 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants