【发布时间】:2014-08-18 08:42:17
【问题描述】:
我有两个大整数
min=round(raw_min,-5) # a negative number
max=round(raw_max,-5)
从中我得到了一系列有趣的滴答声:
xticks=np.arange(min,max,500000)
在 x 轴上,我希望在 xticks 范围内有小刻度(包括标签)。此外,我希望在值0 处有一个主要的刻度线和网格线。我尝试添加:
minorLocator = FixedLocator(xticks)
majorLocator = FixedLocator([0])
ax.xaxis.set_major_locator(majorLocator)
ax.xaxis.set_major_formatter(FormatStrFormatter('%d'))
ax.xaxis.set_minor_locator(minorLocator)
plt.tick_params(which='both', width=1)
plt.tick_params(which='major', length=7, color='b')
plt.tick_params(which='minor', length=4, color='r')
ax.yaxis.grid(True)
ax.xaxis.grid(b=True,which='major', color='b', linestyle='-')
但它不起作用......
次要没有刻度,主要没有网格线。
有什么想法吗?
【问题讨论】:
-
“不起作用”意味着根本没有图表?没有蜱虫?蜱虫在错误的地方?没有网格线?
标签: python matplotlib