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

Skip to content

Commit b5d3a11

Browse files
committed
fix tick label right example
1 parent c09536b commit b5d3a11

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

examples/ticks_and_spines/tick_label_right.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@
1616
import matplotlib.pyplot as plt
1717
import numpy as np
1818

19+
plt.rcParams['ytick.right'], plt.rcParams['ytick.labelright'] = True, True
20+
plt.rcParams['ytick.left'], plt.rcParams['ytick.labelleft'] = False, False
21+
1922

2023
x = np.array([x for x in range(10)])
2124

22-
_, ax = plt.subplots(3, 1, sharex=True, figsize=(6, 6))
25+
_, ax = plt.subplots(2, 1, sharex=True, figsize=(6, 6))
2326

2427
ax[0].plot(x)
25-
ax[0].yaxis.tick_right()
28+
ax[0].yaxis.tick_left()
2629

30+
# use default parameter in rcParams, not calling tick_right()
2731
ax[1].plot(x)
28-
ax[1].yaxis.tick_left()
29-
30-
plt.rcParams['ytick.right'], plt.rcParams['ytick.labelright'] = True, True
31-
plt.rcParams['ytick.left'], plt.rcParams['ytick.labelleft'] = False, False
32-
33-
ax[2].plot(x)
3432

3533
plt.show()

0 commit comments

Comments
 (0)