9951 explained code solutions for 126 technologies


python-matplotlibHow to change x axis labels (ticks)


import matplotlib.pyplot as plt

plt.plot([2,1,3])
plt.xticks([0,1,2], ['A', 'B', 'C'])
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

xticks(

set labels for x-axis values (ticks)

[0,1,2]

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

['A', 'B', 'C']

labels to use for ticks

.show()

render chart in a separate window