change number of ticks matplotlib

I know many graduate students spend most of their time on plotting :)) And often you would have to change the frequency of xticks or yticks or their labels. Here is what I have to change the number of ticks.

Use two lines below to change the number of xticks or yticks in matplotlib in python.

start, end = ax.get_xlim()
ax.xaxis.set_ticks(np.arange(start, end, stepsize))

Advertisements