Stop gif image from repeating in matplotlib
<p>I searched for other similar questions but that didn't solve my problem. Below is a simple code that generates an animation in the form of a gif image in matplotlib:</p>

<pre><code>import numpy as np
import matplotlib.pylab as plt
import matplotlib.animation as anm

fig = plt.figure()
def draw(i):
    x = np.linspace(0, 5, num = 1000)    
    y = np.sin(x-i*0.1)
    plt.clf()
    plt.plot(x, y, 'r-') 

anim = anm.FuncAnimation(fig, draw, frames = 10, interval = 500, repeat = False)
anim.save('test.gif', fps = 1, writer = 'imagemagick')
</code></pre>

<p>This generates the animation I want but once I open the final image (with eog), it keeps repeating. Since I would be presenting animation in the presentation, I would like it to stop after it is shown once. As you can notice, I have added <code>repeat = False</code> in the FuncAnimation but that doesn't stop repeating the image. What is wrong with my code?</p>

<p>Thanks in advance</p>