python matplotlib 交互式(?)/动态(?)绘图

时间:2021-06-05 01:38:29

标签: python matplotlib

伙计们。

让我有数据 x,y。

x : [1,2,3], y [1,2,3] 

数据 x,y 将每秒钟更新一次,这意味着...

x : [1,2,3,4] , y : [1,2,3,4] - after 1 sec 

x : [1,2,3,4,5], y : [1,2,3,4,5] - after 2 sec (after 1 sec from [1,2,3,4])

如何在 matplotlib 中绘制(绘制)x,y 仅具有附加值?

到目前为止,我是按照以下方式进行的。

fig,ax = plt.subplots() # plt = matplotlib.pyplot

  1. ax.plot(x,y) 与 [1,2,3]
  2. 当数据更新时,ax.clear(), ax.plot(x,y) with [1,2,3,4]
  3. 当数据更新时,ax.clear(), ax.plot(x,y) 与 [1,2,3,4,5]

但是……我认为这是一种愚蠢的事情……
有没有什么方法可以只用添加的数据来绘制(绘图)?

(我认为,这意味着我不需要采取'ax.clear()')

非常感谢您的知识分享!

0 个答案:

没有答案