如果您只想设置一个简单的一行与最小样板的间距:
plt.gca().xaxis.set_major_locator(plt.MultipleLocator(1))
plt.gca().xaxis.set_minor_locator(plt.MultipleLocator(1))
有点饱,但很紧凑