title: Animating multiple subplots using matplotlib
body: <p>I want to animate some sub-plots using matplotlib but I'm having problems getting it to work using FuncAnimation. Here is my animation function</p>
  
  <pre><code>def animate(i):
     global infection_data
     for p in people: 
         p.step()
         p.infect(people)
  
     position_data = np.array([p.pos for p in people])
  
     scatter.set_offsets(position_data)
     scatter.set_edgecolors(["k" if p.state == 0 else "r" for p in people])
  
     new_infection_data = np.array([i + 2, sum([1 if p.state == 1 else 0 for p in people])])
     infection_data = np.vstack((infection_data, new_infection_data))
  
     plot.set_data(infection_data[:,0], infection_data[:,1])
  
     return scatter, plot
  </code></pre>
  
  <p>The scatter and plot are on two different subplots. The scatter works as intended however there is no update to the line on the other subplot. How can I get this to animate?</p>
  
  <p>Heres how I define scatter and plot</p>
  
  <pre><code>fig, ax = plt.subplots(nrows=2)
  scatter = ax[0].scatter((), ())
  plot, = ax[1].plot(infection_data[:,0], infection_data[:,1])
  </code></pre>