import numpy as np plt.set_xticks(np.arange(1900, 2020, 5))
np.arange has parameters (min value, max value, distance between tick marks). This should do the trick.