python中利用matplotlib绘制三维散点图 Axes3D

# 导入库
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 开始绘图
fig = plt.figure()
ax = Axes3D(fig)
x = data[:, 0]
y = data[:, 1]
z = data[:, 2]

ax.scatter(x,y,z)
# 保存图片 显示图片
plt.savefig('the figure named {}'.format(str), format='png', dpi=300, pad_inches=0)
plt.show()
发布了34 篇原创文章 · 获赞 17 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_39393430/article/details/91608119