python and update figure in matplotlib

我怕爱的太早我们不能终老 提交于 2019-12-03 14:19:51

Try using ion from matplotlib.pyplot:

import matplotlib.pyplot as pp
pp.ion()
fig = pp.figure()

More info about ion and interactive vs non-interactive usage here

Alternatively if you want to go with the button press approach assign a callback

def moveon(event):
    pp.close()

cid = fig.canvas.mpl_connect('key_press_event', moveon)
pp.show()

An event timer is more tricky because the show command is blocking, so it would probably have to involve threading.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!