For changing the “tick frequency” on x or y-axis in matplotlib you can explicitly set where you want to tick marks with plt.xticks. Below is an example that shows how to do it:-

plt.xticks(np.arange(min(x), max(x)+1, 1.0))

**An example that illustrates the use of ****plt.xticks****:-**

import numpy as np

import matplotlib.pyplot as plt

x = [0,5,9,10,15]

y = [0,1,2,3,4]

plt.plot(x,y)

plt.xticks(np.arange(min(x), max(x)+1, 1.0))

plt.show()

The np.arange function was used in place of Python's range function just in case min(x) and max(x) are floats instead of ints.