matplot三维图
方式一:Axes3D绘制三维图
from mpl_toolkits.mplot3d import Axes3D
def Plot3D(data): x, y, z = data[0], data[1], data[2] fig = plt.figure() # 创建一个三维的绘图工程
ax = Axes3D(fig) ax.set_zlabel('Z') # 坐标轴 ax.set_ylabel('Y') ax.set_xlabel('X') cx = np.mean(x) cy = np.mean(y) cz = np.mean(z)
#设置坐标范围 delta = 1000 ax.set_xlim(cx-delta, cx+delta) ax.set_ylim(cy-delta, cy+delta) ax.set_zlim(cz-delta, cz+delta)
ax.scatter3D(x,y,z) plt.show()