title: How to animate an array selection with matplotlib animation?
body: <p>I'm learning to work with the matplotlib animation function. I took the tutorial from matplotlib and changed a bit. So far I'm able to show my complete array (list) with length of 10. (see code)</p>
  
  <p>My goal is to see in every frame only e.g. 3 values from the array at the same time. In the next frame the "window" should slide over with the stepsize of 1 Index so that the "old" values will move to the left and at the right are the "more new" values: </p>
  
  <p>1st frame - see values list[3],list[2],list[1] from the array </p>
  
  <p>2nd frame - see values list[4],list[3],list[2] from the array </p>
  
  <p>3rd frame - see values list[5],list[4],list[3] from the array</p>
  
  <p>....</p>
  
  <p>Base Code from matplotlib tutorial, just a bit modified to show my complete array (list) but without updating.</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  
  fig, ax = plt.subplots()
  list = np.array([1,8,3,4,5,3,2,1,5,1])
  line, = ax.plot(np.random.rand(10))
  ax.set_ylim(0, 10)
  
  
  def update(data):
      line.set_ydata(data)
      return line,
  
  def data_gen():
      while True:
          #yield np.random.rand(4)
          yield list
  
  ani = animation.FuncAnimation(fig, update, data_gen, interval=500)
  plt.show()
  </code></pre>
  
  <p>I dont know how I can "slide" my window and then to update the animation. Probably with a for loop over the index of the frames I guess... ?</p>
  
  <p>Which variable consists the index of the frames?</p>
  
  <p>Thx a lot for your time. Have a nice weekend !</p>