【问题标题】:3D plotting of points点的 3D 绘图
【发布时间】:2017-11-14 20:51:38
【问题描述】:

我想使用 python 在给定坐标的情况下在 3D 中绘制一些特定点。我想使用 matplotlib 库,但不确定是否有简单的方法。

假设我想绘制以下几点: (1,0,0) (2,2,2) (-1,2,0) (1,2,1)

【问题讨论】:

标签: python-3.x matplotlib mplot3d


【解决方案1】:

由于周围的一些示例过于复杂,因此 matplotlib 中 3D 散点图的最小示例如下所示:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig, ax = plt.subplots(subplot_kw=dict(projection='3d') )

points = [(1,0,0), (2,2,2), (-1,2,0), (1,2,1)]
x,y,z = zip(*points)
ax.scatter(x,y,z, s=100)
plt.show()

【讨论】:

    猜你喜欢
    • 2021-04-07
    • 2019-03-07
    • 1970-01-01
    • 2014-09-03
    • 2016-04-28
    • 1970-01-01
    • 1970-01-01
    • 2017-04-29
    • 2013-10-18
    相关资源
    最近更新 更多