There are two sets of ticks to mark coordinates on each axis: major and minor ticks. By default, Matplotlib tries to automatically optimize the tick spacing and format based on the data input. Wherever manual adjustment is needed, it can be done through setting these four locators: xmajorLocator, xminorLocator, ymajorLocator, yminorLocator via the function set_major_locator, or set_minor_locator on the respective axis. The following is a usage example, where ax is an axes object:
ax.xaxis.set_major_locator(xmajorLocator)
ax.xaxis.set_minor_locator(xminorLocator)
ax.yaxis.set_major_locator(ymajorLocator)
ax.yaxis.set_minor_locator(yminorLocator)
Here, we list the common locators and their usage.