8000 Merge doc/api/api_overview and doc/api/index. by anntzer · Pull Request #14176 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Merge doc/api/api_overview and doc/api/index. #14176

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 2 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.

71 changes: 60 additions & 11 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,54 @@
.. _api-index:
API Overview
============

####################
The Matplotlib API
####################
Below we describe several common approaches to plotting with Matplotlib. See
also the :doc:`api_changes`.

.. toctree::
:maxdepth: 1
:hidden:

api_changes

.. contents:: :local:

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_overview.rst
api_changes.rst
.. _api-index:

The object-oriented API
-----------------------

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).

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)

Modules
=======
All Matplotlib submodules are documented here:

.. toctree::
:maxdepth: 1
Expand Down Expand Up @@ -73,8 +109,7 @@ Modules
units_api.rst
widgets_api.rst

Toolkits
========
... and the ``mpl_toolkits`` here:

.. toctree::
:maxdepth: 1
Expand All @@ -84,3 +119,17 @@ Toolkits
toolkits/axes_grid1.rst
toolkits/axisartist.rst
toolkits/axes_grid.rst


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.

`matplotlib.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.
0