1
- .. _api-index :
1
+ API Overview
2
+ ============
2
3
3
- ####################
4
- The Matplotlib API
5
- ####################
4
+ Below we describe several common approaches to plotting with Matplotlib. See
5
+ also the :doc: `api_changes `.
6
6
7
- .. toctree ::
8
- :maxdepth: 1
7
+ .. contents :: :local:
8
+
9
+ The pyplot API
10
+ --------------
11
+
12
+ `matplotlib.pyplot ` is a collection of command style functions that make
13
+ Matplotlib work like MATLAB. Each pyplot function makes some change to a
14
+ figure: e.g., creates a figure, creates a plotting area in a figure, plots
15
+ some lines in a plotting area, decorates the plot with labels, etc.
16
+
17
+ `.pyplot ` is mainly intended for interactive plots and simple cases of
18
+ programmatic plot generation.
19
+
20
+ Further reading:
21
+
22
+ - The `matplotlib.pyplot ` function reference
23
+ - :doc: `/tutorials/introductory/pyplot `
24
+ - :ref: `Pyplot examples <pyplots_examples >`
9
25
10
- api_overview.rst
11
- api_changes.rst
26
+ The object-oriented API
27
+ -----------------------
12
28
29
+ At its core, Matplotlib is object-oriented. We recommend directly working
30
+ with the objects, if you need more control and customization of your plots.
13
31
14
- Modules
15
- =======
32
+ In many cases you will create a `.Figure ` and one or more
33
+ `~matplotlib.axes.Axes ` using `.pyplot.subplots ` and from then on only work
34
+ on these objects. However, it's also possible to create `.Figure `\ s
35
+ explicitly (e.g. when including them in GUI applications).
36
+
37
+ Further reading:
38
+
39
+ - `matplotlib.axes.Axes ` and `matplotlib.figure.Figure ` for an overview of
40
+ plotting functions.
41
+ - Most of the :ref: `examples <examples-index >` use the object-oriented approach
42
+ (except for the pyplot section)
43
+
44
+ All Matplotlib submodules are documented here:
16
45
17
46
.. toctree ::
18
47
:maxdepth: 1
@@ -73,8 +102,7 @@ Modules
73
102
units_api.rst
74
103
widgets_api.rst
75
104
76
- Toolkits
77
- ========
105
+ ... and the ``mpl_toolkits `` here:
78
106
79
107
.. toctree ::
80
108
:maxdepth: 1
@@ -84,3 +112,17 @@ Toolkits
84
112
toolkits/axes_grid1.rst
85
113
toolkits/axisartist.rst
86
114
toolkits/axes_grid.rst
115
+
116
+
117
+ The pylab API (disapproved)
118
+ ---------------------------
119
+
120
+ .. warning ::
121
+ Since heavily importing into the global namespace may result in unexpected
122
+ behavior, the use of pylab is strongly discouraged. Use `matplotlib.pyplot `
123
+ instead.
124
+
125
+ `matplotlib.pylab ` is a module that includes `matplotlib.pyplot `, `numpy `
126
+ and some additional functions within a single namespace. Its original purpose
127
+ was to mimic a MATLAB-like way of working by importing all functions into the
128
+ global namespace. This is considered bad style nowadays.
0 commit comments