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

Skip to content

Commit e42e9c0

Browse files
authored
Merge pull request #14936 from meeseeksmachine/auto-backport-of-pr-14932-on-v3.1.x
Backport PR #14932 on branch v3.1.x (DOC: Update invert_example to directly manipulate axis.)
2 parents 1230e83 + c631e7f commit e42e9c0

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)