xiaoleishawnli 2021-04-23 14:10 采纳率: 100%
浏览 55
已采纳

python how to draw a 3D figure using a 3D array?

ax = plt.axes(projection ="3d")
plt.figure()

ax.scatter(res[???],s=2,color="red")
plt.show()

res.shape

(3438, 3)

res

array([[-0.37735112,  0.70916688, -0.11611093],
       [-1.65987721,  0.36333406, -0.15776237],
       [ 0.04139574, -0.6512135 ,  0.58187669],
       ...,
       [ 1.70450881,  3.08870729,  0.53986034],
       [-0.31678427, -0.59254118,  0.20142223],
       [-0.21731326, -0.92191064, -0.18022078]])

 

  • 写回答

9条回答 默认 最新

  • CSDN专家-Yang 2021-04-23 14:29
    关注

    试下这个

    import matplotlib.pyplot as plt
    import numpy as np
    
    fig = plt.figure()
    ax = fig.add_subplot(projection='3d')
    
    ar = np.array([[-0.37735112,  0.70916688, -0.11611093],
           [-1.65987721,  0.36333406, -0.15776237],
           [ 0.04139574, -0.6512135 ,  0.58187669],
           [ 1.70450881,  3.08870729,  0.53986034],
           [-0.31678427, -0.59254118,  0.20142223],
           [-0.21731326, -0.92191064, -0.18022078]])
    
    
    ax.scatter(ar[:,0], ar[:,1], ar[:,2])
    
    ax.set_xlabel('X Label')
    ax.set_ylabel('Y Label')
    ax.set_zlabel('Z Label')
    
    plt.show()

     

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件
  • ¥15 使用ESP8266连接阿里云出现问题