Closed
Description
Bug report
Bug summary
Saving a gif using PillowWriter produces a gif that does not loop. Is there a way to make the gif loop endlessly using PillowWriter?
Code for reproduction
from matplotlib.animation import FuncAnimation, PillowWriter
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 1, 20)
def f(x, i):
return x*np.sin(i/10)
line, = plt.plot(x, f(x, 0))
plt.xlim([0,1])
plt.ylim([-1,1])
fig = plt.gcf()
def animate(i):
line.set_data(x, f(x,i))
anim = FuncAnimation(fig, animate, frames=60, interval=50)
anim.save('fig.gif', writer=PillowWriter(fps=20))
plt.show()
Actual outcome
Expected outcome
Same gif, but I want it to loop once it finishes.
Matplotlib version
- Operating system: Windows 10 Version 1803
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg - Python version: 3.6.5
Matplotlib was installed with conda.