python - 如何在 Python 的 matplotlib 中将多条 2D 线连接/组合到表面
问题描述
我有几个轨道发生在不同的高度。我在 3D 中绘制它们,但我希望将它们与表面连接在一起。
profile = np.array([[ 1.0000e+00, 0.0000e+00],
[ 9.8727e-01, 2.3300e-03],
[ 9.5169e-01, 9.4900e-03],
[ 8.9649e-01, 1.9960e-02],
[ 8.2432e-01, 3.2890e-02],
[ 7.3922e-01, 4.7510e-02],
[ 6.4581e-01, 6.2470e-02],
[ 5.4900e-01, 7.5920e-02],
[ 4.5301e-01, 8.5060e-02],
[ 3.6037e-01, 8.8000e-02],
[ 2.7316e-01, 8.4290e-02],
[ 1.9359e-01, 7.5090e-02],
[ 1.2476e-01, 6.1810e-02],
[ 6.9380e-02, 4.5650e-02],
[ 2.9420e-02, 2.7990e-02],
[ 6.0700e-03, 1.0680e-02],
[ 6.5000e-04, -2.5400e-03],
[ 1.7560e-02, -1.0900e-02],
[ 5.5880e-02, -1.6410e-02],
[ 1.1428e-01, -1.8700e-02],
[ 1.9060e-01, -1.8290e-02],
[ 2.8155e-01, -1.5830e-02],
[ 3.8297e-01, -1.1750e-02],
[ 4.9071e-01, -6.4600e-03],
[ 6.0029e-01, -1.1200e-03],
[ 7.0625e-01, 2.9600e-03],
[ 8.0289e-01, 5.1600e-03],
[ 8.8489e-01, 5.3300e-03],
[ 9.4753e-01, 3.7700e-03],
[ 9.8677e-01, 1.2900e-03],
[ 1.0000e+00, 0.0000e+00]])
x = profile[:, 0]
y = profile[:, 1]
z = 0 * np.ones(x.shape)
z1 = 1 * np.ones(x.shape)
z2 = 2 * np.ones(x.shape)
z3 = 3 * np.ones(x.shape)
z4 = 4 * np.ones(x.shape)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(x, y, z, 'k-', linewidth=3.0)
ax.plot(x*1.1, y*1.1, z2, 'k-', linewidth=3.0)
ax.plot(x*1.2, y*1.2, z3, 'k-', linewidth=3.0)
ax.plot(x*1.3, y*1.3, z4, 'k-', linewidth=3.0)
plt.show()
我希望有人可以帮助我如何从中创建表面?我曾尝试使用meshgrid,但我做错了什么,要么它只是打印我的错误,要么python只在原平面(z = 0)中创建一个表面:(
解决方案
推荐阅读
- apache-spark - ArrayType Pyspark 列中唯一元素行的平均值
- php - 为什么方法重置不存在?
- graphql - AppSync 订阅如何处理解析程序异常?
- firebase - 颤振:火力过滤
- mysql - 从另一个表中获取由逗号分隔的值相关的列的总和
- ios - iOS:Firebase 和 Google AdMob 是否消耗过多能源?我可以改进这个吗?
- android - 如何在 Xamarin Forms Android 中每天同时运行一个任务?
- h2 - 使用 Datagrip 客户端连接到 H2 数据库
- html - 在带有css的文本下放置和大小按钮
- python-3.x - 如何在 subbredit 中获取提交的链接