9951 explained code solutions for 126 technologies


python-matplotlibHow to change ticks labels frequency


In order to change axis labels frequency, we can use nbins option of locator_params to set the amount of ticks we want:

import matplotlib.pyplot as plt

plt.plot([2,1,3,5,3,3,4,5,2,1])
plt.locator_params(nbins=5)
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

locator_params

configure locator object

nbins

sets the amount of tick labels to generate

.show()

render chart in a separate window