繁体   English   中英

如何从循环中更新matplotlib图?

[英]How to update a matplotlib figure from loop?

标题说。

我想用matplotlib绘制点云的演变。 因此,我想在每个循环迭代中重绘同一窗口中的图形而不阻塞应用程序。

编辑1:我的代码的伪代码段

x,y = init_points()  // x,y are 2D coordinates

plt.ion()
plt.figure()
while transformation:
  x, y= transform(x,y)
  plt.plot(x, y)
  plt.draw()

基本上我设法得出了积分。 但新的观点被添加到旧图中。 我想完全重绘一下这个数字。

我想我需要类似于Matlab的hold / hold off

这可能对您有所帮助:

plt.clf()

这清除了这个数字。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM