mplot3d - 如何显示小刻度?
如何使用 mplot3d /axes3d 图形在 3D 曲面图上显示(打开)小刻度?
我可以使用以下方式定义主要刻度线位置:
ax.w_zaxis.set_major_locator(MultipleLocator(10))
类似地,我猜我可以使用以下方式定义次要刻度线:
ax.w_zaxis.set_minor_locator(MultipleLocator(2))
这似乎定义了次要刻度线定位器,但实际上并没有在我的绘图中打开它们。如何在axes3D 中打开小刻度线?
How do I display (turn on) minor ticks on a 3D surface plot using mplot3d / axes3d graph?
I can define the major tickmark locations using:
ax.w_zaxis.set_major_locator(MultipleLocator(10))
Similarly, I'm guessing I can define the the minor ticks using:
ax.w_zaxis.set_minor_locator(MultipleLocator(2))
This appears to define the minor tick locators but doesn't actually turn them on in my plot. How do I turn the minorticks on in my axes3D?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,mplot3d 中并未完全实现小刻度线。我在 matplotlib 代码中查看的位置是
draw()
函数中的Your_Python_Lib_site-packages\mpl_toolkits\mplot3d\axis3d.py
。我只看到绘制主要刻度线的代码,而不是绘制次要刻度线的代码。修改代码以使其也绘制小刻度线似乎并不那么困难。我想知道 matplotlib 的人是否知道小刻度线在 mplot3d 中不起作用。From what I can tell, minor tick marks aren't fully implemented in mplot3d. The place I'm looking at in the matplotlib code is
Your_Python_Lib_site-packages\mpl_toolkits\mplot3d\axis3d.py
in thedraw()
function. I see only the code to draw the major tick marks, not the minor ones. It seems like it wouldn't be all that hard to modify the code to make it draw the minor tick marks too. I wonder if the matplotlib people even know that the minor tick marks don't work in mplot3d.自 v3.3 这可以通过在以下位置设置
minor=True
来完成:As of v3.3 this can be done by setting
minor=True
in: