-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Expand file tree
/
Copy pathtick_label_right.py
More file actions
27 lines (19 loc) · 767 Bytes
/
tick_label_right.py
File metadata and controls
27 lines (19 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
============================================
Set default y-axis tick labels on the right
============================================
We can use :rc:`ytick.labelright`, :rc:`ytick.right`, :rc:`ytick.labelleft`,
and :rc:`ytick.left` to control where on the axes ticks and their labels
appear. These properties can also be set in ``.matplotlib/matplotlibrc``.
"""
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True
plt.rcParams['ytick.left'] = plt.rcParams['ytick.labelleft'] = False
x = np.arange(10)
fig, (ax0, ax1) = plt.subplots(2, 1, sharex=True, figsize=(6, 6))
ax0.plot(x)
ax0.yaxis.tick_left()
# use default parameter in rcParams, not calling tick_right()
ax1.plot(x)
plt.show()