1# Show x axes with intervals of X instead of default (this case default=5)
2import numpy as np
3import matplotlib.pyplot as plt
4
5x = [0,5,9,10,15]
6y = [0,1,2,3,4]
7X = 1.0
8plt.plot(x,y)
9plt.xticks(np.arange(min(x), max(x)+1, X))
10plt.show()
11
1# for matplotlib.pyplot
2# ---------------------
3plt.xticks([], [])
4# for axis object
5# ---------------
6# from Anakhand May 5 at 13:08
7# for major ticks
8ax.set_xticks([])
9# for minor ticks
10ax.set_xticks([], minor=True)
11
1#x-ticks:
2plt.xticks(start, stop, step))
3#y-ticks:
4plt.yticks(np.arange(start,stop,step))