8000 Backport PR #14210 on branch v3.1.x (Make intro tutorial less jargony.) by meeseeksmachine · Pull Request #14211 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #14210 on branch v3.1.x (Make intro tutorial less jargony.) #14211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions tutorials/introductory/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@
# Matplotlib, pyplot and pylab: how are they related?
# ====================================================
#
# Matplotlib is the whole package; :mod:`matplotlib.pyplot`
# is a module in matplotlib; and :mod:`pylab` is a module
# that gets installed alongside :mod:`matplotlib`.
# Matplotlib is the whole package and :mod:`matplotlib.pyplot` is a module in
# Matplotlib.
#
# Pyplot provides the state-machine interface to the underlying
# object-oriented plotting library. The state-machine implicitly and
# automatically creates figures and axes to achieve the desired
# plot. For example:
# For functions in the pyplot module, there is always a "current" figure and
# axes (which is created automatically on request). For example, in the
# following example, the first call to ``plt.plot`` creates the axes, then
# subsequent calls to ``plt.plot`` add additional lines on the same axes, and
# ``plt.xlabel``, ``plt.ylabel``, ``plt.title`` and ``plt.legend`` set the
# axes labels and title and add a legend.

x = np.linspace(0, 2, 100)

Expand All @@ -174,16 +175,9 @@
plt.show()

###############################################################################
# The first call to ``plt.plot`` will automatically create the necessary
# figure and axes to achieve the desired plot. Subsequent calls to
# ``plt.plot`` re-use the current axes and each add another line.
# Setting the title, legend, and axis labels also automatically use the
# current axes and set the title, create the legend, and label the axis
# respectively.
#
# :mod:`pylab` is a convenience module that bulk imports
# :mod:`matplotlib.pyplot` (for plotting) and :mod:`numpy`
# (for mathematics and working with arrays) in a single name space.
# (for mathematics and working with arrays) in a single namespace.
# pylab is deprecated and its use is strongly discouraged because
# of namespace pollution. Use pyplot instead.
#
Expand Down
0