目录
为了绘制立体,主要用到Matplotlib中的一个函数voxels
voxels([x, y, z, ], filled, facecolors=None, edgecolors=None, **kwargs)
绘制一组填充体素,所有体素在坐标轴上绘制为1x1x1立方体,filled[0, 0, 0]的lower corner位于原点。被遮挡的面不再绘制。
一:绘制一个正方体
# 准备一组体素坐标
n_voxels = np.ones((1,1,1), dtype=bool)
# 绘制
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(n_voxels)
plt.show()