如何在 seaborn 中增加网格线的数量?
How the number of grid lines can be increased in seaborn?
我有这么一段代码作图:
sns.set_style("darkgrid")
fig, ax = plt.subplots(1, 1)
x = np.arange(10)
ax.plot(x, x)
它给了我:
seaborn如何增加网格线的数量,使其更密集?
基于这个问题:add minor gridlines to matplotlib plot using seaborn,你可以这样做。
sns.set_style("darkgrid")
fig, ax = plt.subplots(1, 1)
x = np.arange(10)
ax.plot(x, x)
ax.get_xaxis().set_minor_locator(mpl.ticker.AutoMinorLocator())
ax.get_yaxis().set_minor_locator(mpl.ticker.AutoMinorLocator())
ax.grid(b=True, which='major', color='w', linewidth=1.0)
ax.grid(b=True, which='minor', color='w', linewidth=0.5)
你得到这个数字:
我有这么一段代码作图:
sns.set_style("darkgrid")
fig, ax = plt.subplots(1, 1)
x = np.arange(10)
ax.plot(x, x)
它给了我:
seaborn如何增加网格线的数量,使其更密集?
基于这个问题:add minor gridlines to matplotlib plot using seaborn,你可以这样做。
sns.set_style("darkgrid")
fig, ax = plt.subplots(1, 1)
x = np.arange(10)
ax.plot(x, x)
ax.get_xaxis().set_minor_locator(mpl.ticker.AutoMinorLocator())
ax.get_yaxis().set_minor_locator(mpl.ticker.AutoMinorLocator())
ax.grid(b=True, which='major', color='w', linewidth=1.0)
ax.grid(b=True, which='minor', color='w', linewidth=0.5)
你得到这个数字: