set axis ticks matplotlib

Solutions on MaxInterview for set axis ticks matplotlib by the best coders in the world

showing results for - "set axis ticks matplotlib"
Reid
02 Oct 2017
1import numpy as np
2import matplotlib.pyplot as plt
3import matplotlib.ticker as ticker
4
5x = [0,5,9,10,15]
6y = [0,1,2,3,4]
7fig, ax = plt.subplots()
8ax.plot(x,y)
9start, end = ax.get_xlim()
10ax.set_xticks(np.arange(start, end, 2))
11plt.show()
12