@@ -4,41 +4,74 @@ API Reference
4
4
Matplotlib interfaces
5
5
---------------------
6
6
7
- Matplotlib provides two different interfaces:
8
-
9
- - **Axes interface **: create a `.Figure ` and one or more `~.axes.Axes ` objects
10
- (typically using `.pyplot.subplots `), then *explicitly * use methods on these objects
11
- to add data, configure limits, set labels etc.
12
- - **pyplot interface **: consists of functions in the `.pyplot ` module. Figure and Axes
13
- are manipulated through these functions and are only *implicitly * present in the
14
- background.
15
-
16
- See :ref: `api_interfaces ` for a more detailed description of both and their recommended
17
- use cases.
7
+ .. |nbsp | unicode :: 0xA0
8
+ :trim:
18
9
19
10
.. grid :: 1 1 2 2
20
- :padding: 0 0 1 1
11
+ :padding: 0
12
+ :gutter: 2
21
13
22
14
.. grid-item-card ::
15
+ :class-footer: api-interface-footer
23
16
24
17
**Axes interface ** (object-based, explicit)
25
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18
+
19
+ create a `.Figure ` and one or more `~.axes.Axes ` objects, then *explicitly * use
20
+ methods on these objects to add data, configure limits, set labels etc.
21
+
22
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
23
27
24
API:
28
25
29
26
- `~.pyplot.subplots `: create Figure and Axes
30
27
- :mod: `~matplotlib.axes `: add data, limits, labels etc.
31
28
- `.Figure `: for figure-level methods
32
29
30
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31
+
32
+ Example:
33
+
34
+ .. code-block :: python
35
+ :class : api- interface- example
36
+
37
+ fig, ax = plt.subplots()
38
+ ax.plot(x, y)
39
+ ax.set_title(" Sample plot" )
40
+ plt.show()
41
+
42
+ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
43
+
33
44
.. grid-item-card ::
45
+ :class-footer: api-interface-footer
34
46
35
47
**pyplot interface ** (function-based, implicit)
36
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48
+
49
+ consists of functions in the `.pyplot ` module. Figure and Axes are manipulated
50
+ through these functions and are only *implicitly * present in the background.
51
+
52
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37
53
38
54
API:
39
55
40
56
- `matplotlib.pyplot `
41
57
58
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59
+
60
+ Example:
61
+
62
+ .. code-block :: python
63
+ :class : api- interface- example
64
+
65
+ plt.plot(x, y)
66
+ plt.title(" Sample plot" )
67
+ plt.show()
68
+
69
+ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
70
+
71
+
72
+ See :ref: `api_interfaces ` for a more detailed description of both and their recommended
73
+ use cases.
74
+
42
75
43
76
.. _api-index :
44
77
0 commit comments