8000 Backport PR #14176 on branch v3.1.x (Merge doc/api/api_overview and doc/api/index.) by meeseeksmachine · Pull Request #14190 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #14176 on branch v3.1.x (Merge doc/api/api_overview and doc/api/index.) #14190

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
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
2 changes: 1 addition & 1 deletion doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>{{ _('Navigation') }}</h3>
<li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
<li><a href="{{ pathto('gallery/index') }}">examples</a>|&nbsp;</li>
<li><a href="{{ pathto('tutorials/index') }}">tutorials</a>|&nbsp;</li>
<li><a href="{{ pathto('api/api_overview') }}">API</a>|&nbsp;</li>
<li><a href="{{ pathto('api/index') }}">API</a>|&nbsp;</li>
<li><a href="{{ pathto('contents') }}">contents</a> &raquo;</li>

{%- for parent in parents %}
Expand Down
55 changes: 0 additions & 55 deletions doc/api/api_overview.rst

This file was deleted.

77 changes: 68 additions & 9 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,74 @@
API Overview
============

.. toctree::
:hidden:

api_changes

.. contents:: :local:

See also the :doc:`api_changes`.

Usage patterns
--------------

Below we describe several common approaches to plotting with Matplotlib.

The pyplot API
^^^^^^^^^^^^^^

`matplotlib.pyplot` is a collection of command style functions that make
Matplotlib work like MATLAB. Each pyplot function makes some change to a
figure: e.g., creates a figure, creates a plotting area in a figure, plots
some lines in a plotting area, decorates the plot with labels, etc.

`.pyplot` is mainly intended for interactive plots and simple cases of
programmatic plot generation.

Further reading:

- The `matplotlib.pyplot` function reference
- :doc:`/tutorials/introductory/pyplot`
- :ref:`Pyplot examples <pyplots_examples>`

.. _api-index:

####################
The Matplotlib API
####################
The object-oriented API
^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1
At its core, Matplotlib is object-oriented. We recommend directly working
with the objects, if you need more control and customization of your plots.

In many cases you will create a `.Figure` and one or more
`~matplotlib.axes.Axes` using `.pyplot.subplots` and from then on only work
on these objects. However, it's also possible to create `.Figure`\ s
explicitly (e.g. when including them in GUI applications).

api_overview.rst
api_changes.rst
Further reading:

- `matplotlib.axes.Axes` and `matplotlib.figure.Figure` for an overview of
plotting functions.
- Most of the :ref:`examples <examples-index>` use the object-oriented approach
(except for the pyplot section)

The pylab API (disapproved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. warning::
Since heavily importing into the global namespace may result in unexpected
behavior, the use of pylab is strongly discouraged. Use `matplotlib.pyplot`
instead.

`pylab` is a module that includes `matplotlib.pyplot`, `numpy`
and some additional functions within a single namespace. Its original purpose
was to mimic a MATLAB-like way of working by importing all functions into the
global namespace. This is considered bad style nowadays.

Modules
=======
-------

Matplotlib consists of the following submodules:

.. toctree::
:maxdepth: 1
Expand Down Expand Up @@ -73,7 +129,10 @@ Modules
widgets_api.rst

Toolkits
========
--------

:ref:`toolkits-index` are collections of application-specific functions that extend
Matplotlib. The following toolkits are included:

.. toctree::
:maxdepth: 1
Expand Down
0