1.matplotlib绘制3d图形

 matplotlib绘图笔记(1)——绘制3d图形

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



fig = plt.figure()
ax = Axes3D(fig)
#标签
ax.set_xlabel('label 1')
ax.set_ylabel('label 2')
ax.set_zlabel('label 3')
#范围
ax.set_xlim([0,20])
ax.set_ylim([0,20])
ax.set_zlim([0,20])

#绘制3d点
ax.scatter(p[0], p[1], p[2], c='red', s=10)
#3d线
ax.plot([VecStart_x, VecEnd_x[i]], [VecStart_y, VecEnd_y[i]], zs=[VecStart_z, VecEnd_z[i]])
plt.show()
原文地址:https://www.cnblogs.com/onenoteone/p/12441805.html