python - 如何让 matplotlib 绘制多个点
问题描述
我正在做一个项目,我需要在基于 3d 数组的动画中显示点。该数组具有以下形状
(1000,60,2)
其中第一个维度是帧数(因此有 1000 帧),第二个维度是点数(因此每帧需要显示 60 个点),最后一个维度是 x 和 y 坐标(因此是 2) .
我创建了一个简单的更新函数,它只返回每一帧的数据:
fig, ax = plt.subplots()
fig.set_tight_layout(True)
ax.axis([-1,int(boxX + 1),-1,int(boxY + 1)])
point, = ax.plot(0,1, marker="o")
def update(i, posFull, dummy):
return pos[int(i)]
animation = FuncAnimation(fig, update, fargs=(posFull, 0), interval = 2, frames=np.linspace(0,int(stept - 1), int(stept)))
我假设这会返回如下所示的点列表:
(60,2)
我已经打印了返回的数组,看起来我的假设是正确的,但是当我查看动画时,只显示了一个点。其他 59 点在哪里?我该如何展示它们?
解决方案
推荐阅读
- encryption - 可以为端到端加密的每条消息更改密钥对吗?
- javascript - 一页中不固定数量正方形的CSS大网格
- autoscaling - Spinnaker + AWS Autoscaling 生命周期挂钩
- llvm - 无效的 shufflevector 操作数!LLVM JavaCPP
- antlr4 - Antlr4:当有转义字符加回车,换行时单引号规则失败
- flutter - 在设置状态之前何时检查已安装?
- linux - 将相同的文件添加到多个 PACKAGES
- reactjs - Reactjs 在 Bootstrap Modal View 弹出窗口中不显示记录
- python - Kivy 菜单按钮
- python - Keras CNN 错误:预期序列具有 3 个维度,但得到了形状为 (500、400) 的数组