title: matplotlib animation duration
body: <p>the code here below shows and saves an animation of random matrices in succession. My question is how can I adjust the duration of the animation that I save. The only parameters that I have here fps, and dpi control first how many seconds a frame remains and the second controls the quality of the image. <strong>What I want is to actually control the number of frames that are going to be saved</strong> in terms of the matrices the number of them that are actually stored. </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  
  fig = plt.figure()
  
  N = 5
  
  A = np.random.rand(N,N)
  im = plt.imshow(A)
  
  def updatefig(*args):
      im.set_array(np.random.rand(N,N))
      return im,
  
  ani = animation.FuncAnimation(fig, updatefig, interval=200, blit=True) 
  
  ani.save('try_animation.mp4', fps=10, dpi=80) #Frame per second controls speed, dpi       controls the quality 
  plt.show()
  </code></pre>
  
  <p>I am wonderinf if I should add more parameters. I tried to look for the appropriate one in the class documentation in matplotlib but I was unsuccessful:</p>
  
  <p><a href="http://matplotlib.org/api/animation_api.html#module-matplotlib.animation" rel="noreferrer">http://matplotlib.org/api/animation_api.html#module-matplotlib.animation</a></p>