FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clarify that it is ok to use plt.subplots to create figures by ianhi · Pull Request #19554 · matplotlib/matplotlib · GitHub

Repository navigation

Clarify that it is ok to use plt.subplots to create figures - #19554

Closed
ianhi wants to merge 1 commit into
matplotlib:mainfrom
ianhi:patch-2
Closed

ianhi wants to merge 1 commit into
matplotlib:mainfrom
ianhi:patch-2

Conversation

ianhi commented Feb 21, 2021

Copy link
Copy Markdown
Contributor

PR Summary

Adds a line explaining that it is ok to use pyplot methods to create figures. This was (is perhaps) confusing for me and seems to be for other users as well https://discourse.matplotlib.org/t/how-do-i-use-the-object-oriented-interface-without-having-to-rely-on-pyplot/21877

cc @jklymak because this is based on your response to that discourse post.

PR Checklist

  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

This is a real source of confusion for users when told that they should prefer the OO style.
@@ -41,7 +41,8 @@
.. note::

In general, try to use the object-oriented interface over the pyplot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
In general, try to use the object-oriented interface over the pyplot
In general, the explicit interface is preferred over the pyplot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That would require rephrasing the earlier paragraphs in the tutorial as well. That may be a good thing to do but wasn't my intention here. Is this enough of an incremental improvement to stand on its own?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

explicit object-oriented..?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That's better but it is still a break from how the opening paragraph describes things. But perhaps Im worrying too much about that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe fix the first parapraph while we are here? It is not terribly clear.

Comment on lines +44 to +45
interface for making the plots. However, for creating figures and axes
the pyplot interface with `~.pyplot.subplots` should be preferred.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
interface for making the plots. However, for creating figures and axes
the pyplot interface with `~.pyplot.subplots` should be preferred.
interface for making the plots. The `~.pyplot` module still has some useful
shortcuts, and in particular is the preferable method for instantiating figures
and axes via ``fig=plt.figure()`` or ``fig, axs=plt.subplots(2, 1)``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I like this.

jklymak commented Feb 21, 2021

Copy link
Copy Markdown
Member

Maybe something like the above? Or even more detail. There is lots of good stuff in pyplot that this note was not meant to forbid. ie. plt.rcParams is pretty helpful, rather than importing matplotlib.

jklymak marked this pull request as draft February 26, 2021 21:11

jklymak commented Mar 21, 2021

Copy link
Copy Markdown
Member

@ianhi are you coming back to this?

Copy link
Copy Markdown

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

github-actions Bot added the status: inactive Marked by the “Stale” Github Action label Nov 17, 2023

rcomer commented Nov 17, 2023 •
edited
Loading

Copy link
Copy Markdown
Member

This section had a bit of a re-write at #22613 and the relevant note now says "...for plotting". Is there more to do here?

Copy link
Copy Markdown
Member

Wecshiuld align with #26388, which is sort of orthogonal but would need a rewrite of the same sections. I‘d be ok with closing here.

github-actions Bot removed the status: inactive Marked by the “Stale” Github Action label Nov 20, 2023
rcomer closed this Nov 22, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL