1import numpy as np
2import matplotlib.pyplot as plt
3import matplotlib.ticker as ticker
4
5# Fixing random state for reproducibility
6np.random.seed(19680801)
7
8fig, ax = plt.subplots()
9ax.plot(100*np.random.rand(20))
10
11formatter = ticker.FormatStrFormatter('$%1.2f')
12ax.yaxis.set_major_formatter(formatter)
13
14for tick in ax.yaxis.get_major_ticks():
15 tick.label1.set_visible(False)
16 tick.label2.set_visible(True)
17 tick.label2.set_color('green')
18
19plt.show()
20