1
+ API Overview
2
+ ============
3
+
4
+ .. toctree ::
5
+ :hidden:
6
+
7
+ api_changes
8
+
9
+ .. contents :: :local:
10
+
11
+ See also the :doc: `api_changes `.
12
+
13
+ Usage patterns
14
+ --------------
15
+
16
+ Below we describe several common approaches to plotting with Matplotlib.
17
+
18
+ The pyplot API
19
+ ^^^^^^^^^^^^^^
20
+
21
+ `matplotlib.pyplot ` is a collection of command style functions that make
22
+ Matplotlib work like MATLAB. Each pyplot function makes some change to a
23
+ figure: e.g., creates a figure, creates a plotting area in a figure, plots
24
+ some lines in a plotting area, decorates the plot with labels, etc.
25
+
26
+ `.pyplot ` is mainly intended for interactive plots and simple cases of
27
+ programmatic plot generation.
28
+
29
+ Further reading:
30
+
31
+ - The `matplotlib.pyplot ` function reference
32
+ - :doc: `/tutorials/introductory/pyplot `
33
+ - :ref: `Pyplot examples <pyplots_examples >`
34
+
1
35
.. _api-index :
2
36
3
- ####################
4
- The Matplotlib API
5
- ####################
37
+ The object-oriented API
38
+ ^^^^^^^^^^^^^^^^^^^^^^^
6
39
7
- .. toctree ::
8
- :maxdepth: 1
40
+ At its core, Matplotlib is object-oriented. We recommend directly working
41
+ with the objects, if you need more control and customization of your plots.
42
+
43
+ In many cases you will create a `.Figure ` and one or more
44
+ `~matplotlib.axes.Axes ` using `.pyplot.subplots ` and from then on only work
45
+ on these objects. However, it's also possible to create `.Figure `\ s
46
+ explicitly (e.g. when including them in GUI applications).
9
47
10
- api_overview.rst
11
- api_changes.rst
48
+ Further reading:
12
49
50
+ - `matplotlib.axes.Axes ` and `matplotlib.figure.Figure ` for an overview of
51
+ plotting functions.
52
+ - Most of the :ref: `examples <examples-index >` use the object-oriented approach
53
+ (except for the pyplot section)
54
+
55
+ The pylab API (disapproved)
56
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
57
+
58
+ .. warning ::
59
+ Since heavily importing into the global namespace may result in unexpected
60
+ behavior, the use of pylab is strongly discouraged. Use `matplotlib.pyplot `
61
+ instead.
62
+
63
+ `pylab ` is a module that includes `matplotlib.pyplot `, `numpy `
64
+ and some additional functions within a single namespace. Its original purpose
65
+ was to mimic a MATLAB-like way of working by importing all functions into the
66
+ global namespace. This is considered bad style nowadays.
13
67
14
68
Modules
15
- =======
69
+ -------
70
+
71
+ Matplotlib consists of the following submodules:
16
72
17
73
.. toctree ::
18
74
:maxdepth: 1
@@ -73,7 +129,10 @@ Modules
73
129
widgets_api.rst
74
130
75
131
Toolkits
76
- ========
132
+ --------
133
+
134
+ :ref: `toolkits-index ` are collections of application-specific functions that extend
135
+ Matplotlib. The following toolkits are included:
77
136
78
137
.. toctree ::
79
138
:maxdepth: 1
0 commit comments