python - 使用 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()
解决方案
推荐阅读
- c++ - 为什么基于for循环的范围内的二维数组的元素是T*而不是T(*)[n]?
- javascript - 用户脚本:EventListener 不听(在显示远程 pdf 的选项卡上)
- javascript - 控制台命令有问题,内容无法打印?
- python - Django - 使用来自 python 列表的 src 显示图像
- reactjs - React WebApp 与 Word Press 的集成
- mariadb - MariaDB安装dll文件和window包管理器相关问题
- javascript - 使用 cypress 测试反应应用程序时,无法从样式化组件应用 GlobalStyles
- javascript - 如何在 alpinejs 上显示选择选项
- python - 在列表列表的列表中搜索某些元素的索引
- machine-learning - 什么时候微观和宏观平均值相差很大?