From c1a7e20f0b3d0b45b800783cbd336cd89a2b0bfc Mon Sep 17 00:00:00 2001 From: Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:02:11 -0700 Subject: [PATCH] Backport PR #29240: DOC: Add plt.show() to introductory pyplot example --- lib/matplotlib/pyplot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index e864479f1b1b..ba7a5e32f5d0 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -15,6 +15,7 @@ x = np.arange(0, 5, 0.1) y = np.sin(x) plt.plot(x, y) + plt.show() The explicit object-oriented API is recommended for complex plots, though pyplot is still usually used to create the figure and often the Axes in the @@ -29,6 +30,7 @@ y = np.sin(x) fig, ax = plt.subplots() ax.plot(x, y) + plt.show() See :ref:`api_interfaces` for an explanation of the tradeoffs between the