Python 绘制 3D 数据
一、XYZ数据: points.csv
1.1,1.2,1.3
2.1,2.2,2.3
3.1,3.2,3.3
4.1,4.2,4.3
一、Python绘制脚本: plot_3D.py
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import pandas as pd
points = pd.read_csv('points.csv')
frame = pd.DataFrame(points)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = frame.iloc[:,0]
y = frame.iloc[:,1]
z = frame.iloc[:,2]
# x y z
# 1.1,1.2,1.3
# 2.1,2.2,2.3
# 3.1,3.2,3.3
# 4.1,4.2,4.3
ax.scatter(x, y, z, c='r', marker='o')
plt.show()
评论已关闭