title: Animated interactive plot using matplotlib
body: <p>While looking for a way to make animated interactive plot using matplotlib, I encountered this piece of code on Stack overflow documentation:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  from matplotlib.widgets import Slider
  
  TWOPI = 2*np.pi
  
  fig, ax = plt.subplots()
  
  t = np.arange(0.0, TWOPI, 0.001)
  initial_amp = .5
  s = initial_amp*np.sin(t)
  l, = plt.plot(t, s, lw=2)
  
  ax = plt.axis([0,TWOPI,-1,1])
  
  axamp = plt.axes([0.25, .03, 0.50, 0.02])
  # Slider
  samp = Slider(axamp, 'Amp', 0, 1, valinit=initial_amp)
  
  def update(val):
      # amp is the current value of the slider
      amp = samp.val
      # update curve
      l.set_ydata(amp*np.sin(t))
      # redraw canvas while idle
      fig.canvas.draw_idle()
  
  # call update function on slider value change
  samp.on_changed(update)
  
  plt.show()
  </code></pre>
  
  <p>This code does almost exactly what I'm looking for, but I would wish to animate the plot, i.e. make the slider moves automatically from left to right, for instance progressing of 0.01 every second. Is there any simple way of doing that? Knowing that I also want to keep the manual control on the slider (using click event). </p>