diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index a7afc9ae63f1..5f6bf49f1a6c 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -873,7 +873,7 @@ def subplots(self, nrows=1, ncols=1, *, sharex=False, sharey=False, y = np.sin(x**2) # Create a figure - plt.figure() + fig = plt.figure() # Create a subplot ax = fig.subplots()