plt ticks code example

Example 1: plt.xticks

# Show x axes with intervals of X instead of default (this case default=5)
import numpy as np
import matplotlib.pyplot as plt

x = [0,5,9,10,15]
y = [0,1,2,3,4]
X = 1.0
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, X))
plt.show()

Example 2: change xticks python

plt.xticks(np.arange(0,10),np.arange(10,20))

Example 3: plt tickpad

ax.tick_params(axis='both', which='major', pad=15)

or for just x axis

ax.tick_params(axis='x', which='major', pad=15)