Skip to content

Improve matplotlib.axes documentation #24769

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

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

timhoffm
Copy link
Member

  • Move the Axes class documentation to a sub-page. The constructor is quite lengthy and not needed by most users.
  • Add an introductory sentence to set the context for the subsequent listing and structure of the Axes methods.

Note: I've removed the inheritance diagram, because it does not contain much relevant information.
The inheritance from _AxesBase is shown in the class docstring as well (and is not of much use since the private _AxesBase does not have generated documentation. The only additional information is that it originally inherits from Artist, which I've now included as a sentence in the docstring.

@timhoffm timhoffm added this to the v3.7.0 milestone Dec 19, 2022
Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

I like the idea of this change but am being nit picky about wording 'cause this is sort of one of the most conceptually important things to grok. Maybe embed the anatomy figure if it's now its own page?

@@ -46,10 +46,14 @@
@_docstring.interpd
class Axes(_AxesBase):
"""
The `Axes` contains most of the figure elements: `~.axis.Axis`,
The Axes class represents one (sub-)plot in a figure.
Copy link
Member

Choose a reason for hiding this comment

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

I get the the original wording is a problem because a figure can contain multiple Axes, but I think represents is the wrong word here too since that implies some sort of abstraction but modifying an axes object modifies the corresponding plot.

It's something like "An Axes object encapsulates all the elements of an individual (sub-plot) in a figure" but we're sorta inconsistent about using plot to refer to the axes and everything it contains or to the semantic elements within the plot (plot types gallery)

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to your suggestion. This is mainly a structural PR. The goal is to declutter https://matplotlib.org/devdocs/api/axes_api.html#module-matplotlib.axes so that it does not start with two screens full of unhelpful Axes constructor documentation.

There's still lots of room for content improvement. But I would like to defer this to another PR. IMHO the Anatomy figure has too much detail for the Axes context. I would like a "Parts of a figure" reference page that defines our terminology. This is part of the bigger discussion about kinds of documentation. A tutorial is not a reference point for such reference documentation. This is beyond

Copy link
Member

Choose a reason for hiding this comment

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

I would like a "Parts of a figure" reference page that defines our terminology.

Agree that would be awesome

Copy link
Contributor

@j1642 j1642 left a comment

Choose a reason for hiding this comment

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

Should "plotted data" and "axis ticks" be separate?

@QuLogic
Copy link
Member

QuLogic commented Dec 21, 2022

This has caused many duplicate entries, perhaps too much for GitHub to display.

- Move the Axes class documentation to a sub-page.
  The constructor is quite lengthy and not needed by
  most users.
- Add an introductory sentence to set the context for the
  subsequent listing and structure of the Axes methods.

Note: I've removed the inheritance diagram, because it
does not contain much relevant information.
The inheritance from _AxesBase is shown in the class
docstring as well. The only additional information is
that it originally inherits from Artist, which I've
now included as a sentence in the docstring.

Co-authored-by: hannah <story645@gmail.com>
Co-authored-by: j1642 <60148902+j1642@users.noreply.github.com>
@tacaswell tacaswell merged commit ddf33db into matplotlib:main Dec 22, 2022
@timhoffm timhoffm deleted the doc-axes-class branch December 22, 2022 19:29
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.

5 participants