使用matplotlib python在3D中绘制多个相交平面

时间:2020-04-21 05:07:40

标签: python numpy matplotlib math

我正在尝试使用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()

my plot

0 个答案:

没有答案