【问题标题】:Animation of points in Python (matplotlib)Python中的点动画(matplotlib)
【发布时间】:2021-04-02 06:03:13
【问题描述】:

我有一个带有点 (x, y) 的给定列表,它在给定函数的过程中会发生变化,例如: arr = [(1, 2), (1, 3), (5, 6), (8, 1)],即点(1, 2), (1, 3), (5, 6), (8, 1)的坐标

for i in range (5):
     arr = function (arr) # different array

在每个循环之后,我想绘制一个带有标记点的坐标图,即我想从中创建一个动画。这如何在 Python 中完成?

【问题讨论】:

    标签: python numpy matplotlib animation graph


    【解决方案1】:

    我会说不要在任何循环中绘制它们。只需累积所有这些值,将其传递给您正在使用的任何绘图库(matplotlib 确实支持动画)。看这里:https://matplotlib.org/3.3.3/api/animation_api.html

    如果您的数据是流式传输的,可能会使用一些时间窗口。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-25
      • 2021-10-21
      • 2021-11-05
      • 2017-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多