8000 DOC: clarify what we mean by object oriented · matplotlib/matplotlib@de80ee4 · GitHub
[go: up one dir, main page]

Skip to content

Commit de80ee4

Browse files
jklymaktacaswell
andcommitted
DOC: clarify what we mean by object oriented
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
1 parent 88ba86b commit de80ee4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/matplotlib/pyplot.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
"""
55
`matplotlib.pyplot` is a state-based interface to matplotlib. It provides
6-
a MATLAB-like way of plotting.
6+
an implicit, MATLAB-like, way of plotting. It also opens figures on your screen, and
7+
acts as the figure GUI manager.
78
89
pyplot is mainly intended for interactive plots and simple cases of
910
programmatic plot generation::
@@ -15,7 +16,19 @@
1516
y = np.sin(x)
1617
plt.plot(x, y)
1718
18-
The object-oriented API is recommended for more complex plots.
19+
The explicit (object-oriented) API is recommended for complex plots, though pyplot
20+
is still usually used to create the figure and often the axes in the figure.
21+
See `.pyplot.figure`, `.pyplot.subplots`, and `.pyplot.subplot_mosaic` to
22+
create figures, and :doc:`Axes API <../axes_api>` for the plotting
23+
methods on an axes::
24+
25+
import numpy as np
26+
import matplotlib.pyplot as plt
27+
28+
x = np.arange(0, 5, 0.1) 5838
29+
y = np.sin(x)
30+
fig, ax = plt.subplots()
31+
ax.plot(x, y)
1932
"""
2033

2134
import functools

0 commit comments

Comments
 (0)
0