从Matplotlib 3d Scatter中删除窗口

时间:2018-01-19 15:46:53

标签: python matplotlib data-visualization

我的三维图形上的轴标有标记,但在我的三维投影周围仍然存在这个通用的二维框架,我无法摆脱它。

如何删除3d图形外部的x和y [0,1]轴?

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, axisbg="None")
ax = fig.gca(projection='3d')
ax.scatter(X[:, 1], X[:, 0], X[:, 2], c=labels, alpha=0.4)

ax.set_xlabel('Pressure Integral', fontsize=12, color='blue', rotation=150)
ax.set_ylabel('Total Gallons', fontsize=12, color='blue')
ax.set_zlabel('Duration (seconds)', fontsize=12, color='blue', rotation=60)
ax.yaxis._axinfo['label']['space_factor'] = 3.0

enter image description here

1 个答案:

答案 0 :(得分:1)

你“绝对”确实放了这条线

ax = fig.add_subplot(1, 1, 1, axisbg="None")
你的代码中的

。删除此行,以除去它产生的轴。