首页 > 解决方案 > 使用 matplotlib python 在 3D 中绘制多个相交平面

问题描述

我正在尝试使用 Matplotlib 在 3D 空间中绘制三个平面。
到目前为止我得到的东西看起来不太好,我想问一下。
有没有更好的解决方案,所以它们相交?

x = np.linspace(-5,5,2)
y = np.linspace(-5,5,2)
z = np.linspace(-5,5,2)

X,Z = np.meshgrid(x,z)
Y1 = -2*X
Y2 = (-1+X+Z)/2
Y3 = -(4-4*z)/3

# plot the surface
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')


ax.plot_surface(X, Y1, Z, alpha=0.5)
ax.plot_surface(X, Y2, Z, alpha=0.5)
ax.plot_surface(X, Y3, Z, alpha=0.5)
plt.show()

我的阴谋

标签: pythonnumpymatplotlibmath

解决方案


推荐阅读