Skip to content

Expand the explanation of the Object-Oriented interface #18249

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

Closed
ianhi opened this issue Aug 14, 2020 · 6 comments · Fixed by #22613
Closed

Expand the explanation of the Object-Oriented interface #18249

ianhi opened this issue Aug 14, 2020 · 6 comments · Fixed by #22613
Milestone

Comments

@ianhi
Copy link
Contributor

ianhi commented Aug 14, 2020

Problem

Most of the content of https://matplotlib.org/tutorials/introductory/lifecycle.html#a-note-on-the-object-oriented-api-vs-pyplot will not make sense to a user new matplotlib ( and likely new to python). The text makes several assumptions about the reader:

  • They know what object oriented means
  • They know what a state-based interface is
  • They know what the Matlab interface is like
  • They understand "we utilize an instance of axes.Axes in order to render visualizations on an instance of figure.Figure."
    • Doesn't pyplot also do this under the hood?

As a piece of anecdata I was fairly confused by all of this both years ago when I started using matplotlib and more recently when I started to make more complex and interactive matplotlib plots.

Suggested Improvement

Add deeper explanations/definitions for all the above bullet points. As well it would be great to expand on the note that simply says:

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

with a justification of that claim.

A related example is https://matplotlib.org/gallery/api/agg_oo_sgskip.html which could also use some more explanation or perhaps removal.

@ianhi
Copy link
Contributor Author

ianhi commented Aug 14, 2020

Annoyingly this issue was not automatically labelled with the Documentation tag like it should have been following #18161

I'm trying to look into that but if anyone has any ideas 🤷‍♂️

edit labelling issue should be fixed by #18250

@pspiagicw
Copy link

Has this issue been resolved ?

@timhoffm
Copy link
Member

timhoffm commented Feb 7, 2022

AFAICS partially addressed by #21877.

@jklymak
Copy link
Member

jklymak commented Feb 18, 2022

@ianhi can we close this, or do you have feedback on #21877 which is now in the devdocs: https://matplotlib.org/devdocs/users/explain/api_interfaces.html#matplotlib-application-interfaces-apis That is just a start and we should continue to refine it.

@ianhi
Copy link
Contributor Author

ianhi commented Mar 5, 2022

@jklymak that looks good!

I do think that that should be linked to from various place in the docs. e.g. the pyplot tutorial: https://matplotlib.org/devdocs/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py which still uses the object-oriented terminology

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants