如何在Matplotlib(python)中隐藏轴和网格线

时间:2017-07-17 15:58:22

标签: python matplotlib

我希望能够在3D matplotlib图上隐藏轴和网格线。我想这样做,因为当放大和缩小图像变得非常讨厌。我不确定要包含哪些代码,但这是我用来创建图表的内容。

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()

这是我正在看的情节的一个例子:
This is an example of the plot that I am looking at

2 个答案:

答案 0 :(得分:37)

  SELECT 
      T1."CardName"
      ,min( T0."Dscription")
      , T0."DocEntry"
  FROM INV1 T0  
  INNER JOIN OINV T1 ON T0."DocEntry" = T1."DocEntry" 
  INNER JOIN NNM1 T2 ON T1."Series" = T2."Series" 
  WHERE T1."DocTotal" > 1000
  AND T0."DocDate" between [%1] and [%2]
   GROUP BY  T1."CardName", T0."DocEntry"

注意,# Hide grid lines ax.grid(False) # Hide axes ticks ax.set_xticks([]) ax.set_yticks([]) ax.set_zticks([]) 需要使用matplotlib> = 1.2才能正常工作。

答案 1 :(得分:31)

关闭轴:

plt.axis('off')

和网格线:

plt.grid(b=None)