9951 explained code solutions for 126 technologies


python-matplotlibHow to change y axis labels (ticks)


import matplotlib.pyplot as plt

plt.plot([2,1,3])
plt.yticks([1,2,3], ['10a', '20b', '30c'])
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

yticks(

set labels for y-axis values (ticks)

[2,1,3]

list of ticks to set labels for (= list of y-axis values)

['10a', '20b', '30c']

labels to use for ticks

.show()

render chart in a separate window