Numero di zecche del dollaro

Utilizzare a FormatStrFormatterper anteporre i simboli del dollaro alle etichette dell'asse y.

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)

fig, ax = plt.subplots()
ax.plot(100*np.random.rand(20))

# Use automatic StrMethodFormatter
ax.yaxis.set_major_formatter('${x:1.2f}')

ax.yaxis.set_tick_params(which='major', labelcolor='green',
                         labelleft=False, labelright=True)

plt.show()
tick del dollaro

Galleria generata da Sphinx-Gallery