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