ax.xaxis.set_major_locator(MultipleLocator(1.0))
ax.yaxis.set_major_locator(MultipleLocator(1.0))
ax.xaxis.set_major_formatter(FormatStrFormatter('%i'))
plt.show()
How to add constant-spaced ticks on axes whose lenghts vary? [Python]