Matplotlib animation either freezes after a few frames or just doesn't work

前端 未结 8 1343
悲哀的现实
悲哀的现实 2020-12-18 06:04

I\'ve been trying for hours to get this simple script working, but nothing I do seems to help. It\'s a slight modification of the most basic animated plot sample code from t

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-18 06:45

    When you say freezes after the first couple of frames do you mean 2 or 3, or say, 40 or 60, as those are the upper limits of your loop?

    If you want the animation to continue indefinitely you need something like

    while True:
        d = randn(10)
        line.set_ydata(d)
        draw()
        time.sleep(10e-3)
    

    But you'll have to force quit your program.

提交回复
热议问题