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