From c631e7f4a56444af0ba4b228aafff937cd6d4d87 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 31 Jul 2019 00:56:09 -0400 Subject: [PATCH] Backport PR #14932: DOC: Update invert_example to directly manipulate axis. --- examples/subplots_axes_and_figures/invert_axes.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/subplots_axes_and_figures/invert_axes.py b/examples/subplots_axes_and_figures/invert_axes.py index d8c17a1ba81a..15ec55d430bd 100644 --- a/examples/subplots_axes_and_figures/invert_axes.py +++ b/examples/subplots_axes_and_figures/invert_axes.py @@ -12,13 +12,14 @@ t = np.arange(0.01, 5.0, 0.01) s = np.exp(-t) -plt.plot(t, s) -plt.xlim(5, 0) # decreasing time +fig, ax = plt.subplots() -plt.xlabel('decreasing time (s)') -plt.ylabel('voltage (mV)') -plt.title('Should be growing...') -plt.grid(True) +ax.plot(t, s) +ax.set_xlim(5, 0) # decreasing time +ax.set_xlabel('decreasing time (s)') +ax.set_ylabel('voltage (mV)') +ax.set_title('Should be growing...') +ax.grid(True) plt.show()