Skip to content

Pyplot gallery section is mostly OO examples #15922

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
19 tasks
story645 opened this issue Dec 12, 2019 · 4 comments · Fixed by #24054
Closed
19 tasks

Pyplot gallery section is mostly OO examples #15922

story645 opened this issue Dec 12, 2019 · 4 comments · Fixed by #24054
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Milestone

Comments

@story645
Copy link
Member

story645 commented Dec 12, 2019

Somewhere between all the convert things to OO and restructure gallery PRs, the pyplot section of the gallery now has very little pyplot content:

PyPlot

OO

I think there should be a standalone pyplot only gallery page, but think for this PR a potential resolution would be to sort the OO examples into the correct sections (possibly combining them with existing content) or altogether remove them if they're not adding any information.

xref: #15355 because I think this contributes to some of the confusion discussed there.

@story645 story645 changed the title Pyplot gallery contains none pyplot images Pyplot gallery section is mostly OO examples Dec 12, 2019
@kolibril13
Copy link
Contributor

From #15938 timhoffm wrote:

What we can do right now
In the short term, it would really help to better document the similarities and differences between pyplot and OO style. The current docs are not quite instructive on that; and no matter what we could add immediately what we plan to do in the long term, these are public APIs and will therefore be around for a long time.

Additional thoughts
It may even be a good idea to have a complete separation on the API level, in the sense that there should be non-pyplot helper functions for figure/subplot creation (It might be that we still use the same figure management under the hood). That way, one can have two completely separate APIs. Emphasizing this may help to reduce confusion.

My thought to this:
Is it possible to have the whole API default to the pyplot style, but every example has a button that switches the code example from pyplot to OO?
So that people can choose which code they want to see.

@timhoffm
Copy link
Member

timhoffm commented Jan 2, 2020

Thanks for the idea! Unfortunately, switching examples between pyplot and OO is not feasible IMHO.

  • The examples are created from pure python files using sphinx-gallery. The switching mechanism would have to be integrated into that framework.
  • We‘d need two versions of each example. IMHO auto-conversion is not feasible due to the hidden state in pyplot. Creating such a tool would either fail in more complicated cases or be extremely complicated to write. Given the large amount of examples, manually creating and maintaining multiple versions is also not an option.

@jklymak
Copy link
Member

jklymak commented Sep 28, 2022

There is some arguing about what should stay or go, but actually fixing this is pretty easy, so marking good first issue

@StefRe
Copy link
Contributor

StefRe commented Sep 28, 2022

As I'm the culprit of bringing up this topic again in #24023, here's my proposal:

Example Decision
Align y-labels move to Text, labels and annotations
Annotate Transform move to Text, labels and annotations
Annotating a plot move to Text, labels and annotations
Annotation Polar move to Text, labels and annotations
Programmatically controlling subplot adjustment move to Subplots, axes and figures
Infinite lines keep
Boxplot Demo move to Statistics remove (same as Boxplots in Statistics)
Dollar Ticks remove (already covered by Tick formatters in Ticks section in much more detail move to Ticks (the artists tutorial refers to it, so keep it)
Fig Axes Customize Simple move to Ticks
Simple axes labels remove it (already covered by "Pyplot Simple" and the second example in Using accented text in Matplotlib example)
Adding lines to figures move to Miscellaneous
plot() format string remove and merge into "Pyplot Simple"
Pyplot Mathtext keep
Pyplot Simple keep and combine with "plot() format string"
Pyplot Text keep
Pyplot Three keep
Pyplot Two Subplots keep
Text Commands move to Text, labels and annotations (although there already lots of similar examples there)
Text Layout remove (duplicate of Text alignment in Text, labels and annotations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Good first issue Open a pull request against these issues if there are no active ones!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants