Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59c49ab

Browse files
authored
Merge pull request #14932 from Carreau/invert_axes_plt
DOC: Update invert_example to directly manipulate axis.
2 parents efec9e7 + 8e2a745 commit 59c49ab

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/subplots_axes_and_figures/invert_axes.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212

1313
t = np.arange(0.01, 5.0, 0.01)
1414
s = np.exp(-t)
15-
plt.plot(t, s)
1615

17-
plt.xlim(5, 0) # decreasing time
16+
fig, ax = plt.subplots()
1817

19-
plt.xlabel('decreasing time (s)')
20-
plt.ylabel('voltage (mV)')
21-
plt.title('Should be growing...')
22-
plt.grid(True)
18+
ax.plot(t, s)
19+
ax.set_xlim(5, 0) # decreasing time
20+
ax.set_xlabel('decreasing time (s)')
21+
ax.set_ylabel('voltage (mV)')
22+
ax.set_title('Should be growing...')
23+
ax.grid(True)
2324

2425
plt.show()

0 commit comments

Comments
 (0)