用Matplotlib绘制3D多边形

时间:2020-03-02 10:36:50

标签: matplotlib 3d polygon

我用下面的代码绘制3D多边形:

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.set_xlim((0, 5))
ax.set_ylim((0, 5))
ax.set_zlim((0, 5))
x = [1,2,3, 3,2,1]
y = [2,1,2, 2,1,2]
z = [1,1,1, 2,2,2]
v = [list(zip(x, y, z))]
pc = Poly3DCollection(v)
ax.add_collection3d(pc)

从一个角度来看,结果是好的:

enter image description here

但对方意外:

enter image description here

我的代码有问题吗?

0 个答案:

没有答案