如何隐藏Matplotlib中的坐标轴和网格线(python)
问题描述:
我希望能够在3D matplotlib图上隐藏坐标轴和网格线。我想这样做,因为放大和缩小图像变得非常讨厌。我不确定在这里包含哪些代码,但这是我用来创建图表的。如何隐藏Matplotlib中的坐标轴和网格线(python)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.view_init(30, -90)
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
plt.xlim(0,pL)
plt.ylim(0,pW)
ax.set_aspect("equal")
plt.show()
这是我在看情节的例子:
答
# Hide grid lines
ax.grid(False)
# Hide axes ticks
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
注意,你需要matplotlib> = 1.2 set_zticks()
工作。
答
转动轴与关闭:
plt.axis('off')
和网格线用:
ax.grid(False)
尼斯建议。 –