@@ -4,41 +4,74 @@ API Reference
44Matplotlib interfaces
55---------------------
66
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:
189
1910.. grid :: 1 1 2 2
20- :padding: 0 0 1 1
11+ :padding: 0
12+ :gutter: 2
2113
2214 .. grid-item-card ::
15+ :class-footer: api-interface-footer
2316
2417 **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+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2623
2724 API:
2825
2926 - `~.pyplot.subplots `: create Figure and Axes
3027 - :mod: `~matplotlib.axes `: add data, limits, labels etc.
3128 - `.Figure `: for figure-level methods
3229
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+
3344 .. grid-item-card ::
45+ :class-footer: api-interface-footer
3446
3547 **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+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3753
3854 API:
3955
4056 - `matplotlib.pyplot `
4157
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+
4275
4376.. _api-index :
4477
0 commit comments