如何设置次要定位器
How to set minor locator
我是 matplotlib 的初学者,遇到了一个关于 minor_locators 的问题。我试着查找它,但无法弄清楚如何在我的条形图中创建它们。非常感谢任何帮助。
设置 minor_locators 的最简单方法是使用 AutoMinorLocator()。它为您提供通常最合适的次要刻度,而无需手动设置它们。
将所有这些添加到您的常规图表的代码中,您应该可以开始了:
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
ax = plt.gca()
ax.yaxis.set_minor_locator(AutoMinorLocator())
ax.xaxis.set_minor_locator(AutoMinorLocator())
有关更具体的报价,请阅读官方文档here
我是 matplotlib 的初学者,遇到了一个关于 minor_locators 的问题。我试着查找它,但无法弄清楚如何在我的条形图中创建它们。非常感谢任何帮助。
设置 minor_locators 的最简单方法是使用 AutoMinorLocator()。它为您提供通常最合适的次要刻度,而无需手动设置它们。 将所有这些添加到您的常规图表的代码中,您应该可以开始了:
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
ax = plt.gca()
ax.yaxis.set_minor_locator(AutoMinorLocator())
ax.xaxis.set_minor_locator(AutoMinorLocator())
有关更具体的报价,请阅读官方文档here