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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/_templates/autosummary_class_only.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ fullname | escape | underline }}


.. currentmodule:: {{ module }}


{% if objtype in ['class'] %}
.. auto{{ objtype }}:: {{ objname }}
:no-members:

{% endif %}
19 changes: 10 additions & 9 deletions doc/api/axes_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
``matplotlib.axes``
*******************

The `~.axes.Axes` class represents one (sub-)plot in a figure. It contains the
plotted data, axis ticks, labels, title, legend, etc. Its methods are the main
interface for manipulating the plot.

.. currentmodule:: matplotlib.axes

.. contents:: Table of Contents
Expand All @@ -14,18 +18,15 @@
:no-members:
:no-undoc-members:

Inheritance
===========
.. inheritance-diagram:: matplotlib.axes.Axes
:private-bases:

The Axes class
==============

.. autoclass:: Axes
:no-members:
:no-undoc-members:
:show-inheritance:
.. autosummary::
:toctree: _as_gen
:template: autosummary_class_only.rst
:nosignatures:

Axes

Plotting
========
Expand Down
7 changes: 6 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@
@_docstring.interpd
class Axes(_AxesBase):
"""
The `Axes` contains most of the figure elements: `~.axis.Axis`,
An Axes object encapsulates all the elements of an individual (sub-)plot in
a figure.

It contains most of the (sub-)plot elements: `~.axis.Axis`,
`~.axis.Tick`, `~.lines.Line2D`, `~.text.Text`, `~.patches.Polygon`, etc.,
and sets the coordinate system.

Like all visible elements in a figure, Axes is an `.Artist` subclass.

The `Axes` instance supports callbacks through a callbacks attribute which
is a `~.cbook.CallbackRegistry` instance. The events you can connect to
are 'xlim_changed' and 'ylim_changed' and the callback will be called with
Expand Down