Cannot save matplotlib animation with ffmpeg

前端 未结 4 898
无人共我
无人共我 2020-12-14 18:50

I am trying to save a simple matplotlib animation from Jake Vanderplas, but I keep getting OSError: [Errno 13] Permission denied.

I should note that I

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 19:18

    I had garbling issues when I first (naively) tried to modify the working example of answer 3 to show the graph in realtime (as well as keep the movie).

    Not quite right mods of answer 3 (which worked for me)

    1. plt.ion() # interaction on
    2. plt.draw() and plt.show() inside animate function, before return statent
    3. frames=20, interval=200 to slow graph creation a bit, but still make a 4 second movie

    Now plot shows up in a window as it is being created, but the output movie is garbled.

    Correct step 2:

    • 2a: plt.draw() inside animate function
    • 2b: plt.show() just after the animate function

    Now movie plays back ungarbled.

提交回复
热议问题