title: Create an animation with varied time interval in python
body: <pre><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt 
  import matplotlib.animation as animation
  fig, ax = plt.subplots(figsize=(3,9))
  dot, = ax.plot([], [], 'ro')
  
  def init():
      ax.set_xlim(0,1)
      ax.set_ylim(0,3)
      return
  
  def gen_dot():
      for i in range(len(list_x_y)):
      newdot = list_x_y[i]
      yield newdot
  
  def update_dot(newd):
      dot.set_data(newd[0],newd[1])
      return dot
  
  ani = animation.FuncAnimation(fig, update_dot, frames = gen_dot, interval = 100, 
  init_func=init)
  ani.save('Steps.gif',writer='imagemagick',fps=24)
  plt.show()
  </code></pre>
  
  <p>Hey Guys, So I was trying to create an animation mimicking a real person walking a treadmill with the code shown above. The thing is, I need a variable time interval so that the person is not working at a constant speed, which is not realistic at all.</p>
  
  <p><br>
  I figured that probably animation function does not support a varied time interval functionality so I tried using a For loop and get a time interval list such that each time in the for loop it will sleep for a specific amount of time and continue...However, JupyterNotebook will not refresh the frames as I intended it to be, creating a static image in the end of the period...Is there any way I can create a gif with varied time interval? I think maybe I can save all the frames and use imageio to create a gif...But does imageio take varied time interval as input as well? I'm struggling with this problems for hours...Any help would be appreciated. Thanks!</p>