diff --git a/galleries/examples/pyplots/pyplot_three.py b/galleries/examples/pyplots/pyplot_three.py deleted file mode 100644 index b14998cca4c9..000000000000 --- a/galleries/examples/pyplots/pyplot_three.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -=========================== -Multiple lines using pyplot -=========================== - -Plot three datasets with a single call to `~matplotlib.pyplot.plot`. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# evenly sampled time at 200ms intervals -t = np.arange(0., 5., 0.2) - -# red dashes, blue squares and green triangles -plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') -plt.show() - -# %% -# -# .. admonition:: References -# -# The use of the following functions, methods, classes and modules is shown -# in this example: -# -# - `matplotlib.axes.Axes.plot` / `matplotlib.pyplot.plot` diff --git a/galleries/examples/pyplots/pyplot_two_subplots.py b/galleries/examples/pyplots/pyplot_two_subplots.py index 2eb0237d5521..b532c7b1534d 100644 --- a/galleries/examples/pyplots/pyplot_two_subplots.py +++ b/galleries/examples/pyplots/pyplot_two_subplots.py @@ -3,7 +3,18 @@ Two subplots using pyplot ========================= -Create a figure with two subplots using `.pyplot.subplot`. +A typical pyplot usage pattern is to create subplots incrementally through +`~.pyplot.subplot`. + +The three-digit number passed to `~.pyplot.subplot` specifies the position of +the subplot in the grid of subplots. ``211`` means "in a grid of 2 rows and 1 column, +create this subplot in the 1st position". ``212`` likewise means "in a grid of 2 +rows and 1 column, create this subplot in the 2nd position". + +After calling ``subplot()`` all following pyplot commands will modify that subplot +until a new subplot is created. + +.. redirect-from:: /gallery/pyplots/pyplot_three """ import matplotlib.pyplot as plt @@ -21,9 +32,11 @@ def f(t): plt.subplot(211) plt.plot(t1, f(t1), color='tab:blue', marker='o') plt.plot(t2, f(t2), color='black') +plt.title("Subplot 1") plt.subplot(212) plt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--') +plt.title("Subplot 2") plt.show() # %%