title: Animation from matplotlib not working in spyder
body: <p>I'm new to both python and stackoverflow, and I'm going over examples at matplotlib. I've searched for the solution to this problem with no luck, although I was able to locate a <a href="https://stackoverflow.com/questions/27792950/matplotlib-animation-not-working">previously unanswered question</a> in stackoverflow with the same issue.  </p>
  
  <p>Basically, I copied the code available from the examples at <a href="http://matplotlib.org/examples/animation/animate_decay.html" rel="noreferrer">matplotlib</a>; for instance: </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  def data_gen(t=0):
      cnt = 0
      while cnt &lt; 1000:
          cnt += 1
          t += 0.1
          yield t, np.sin(2*np.pi*t) * np.exp(-t/10.)
  def init():
      ax.set_ylim(-1.1, 1.1)
      ax.set_xlim(0, 10)
      del xdata[:]
      del ydata[:]
      line.set_data(xdata, ydata)
      return line,
  
  fig, ax = plt.subplots()
  line, = ax.plot([], [], lw=2)
  ax.grid()
  xdata, ydata = [], []
  
  
  def run(data):
      # update the data
      t, y = data
      xdata.append(t)
      ydata.append(y)
      xmin, xmax = ax.get_xlim()
  
      if t &gt;= xmax:
          ax.set_xlim(xmin, 2*xmax)
          ax.figure.canvas.draw()
      line.set_data(xdata, ydata)
  
      return line,
  
  ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,
                            repeat=False, init_func=init)
  plt.show()
  </code></pre>
  
  <p>I've run various animation examples in both Anaconda 2 (python 2.7) &amp; 3 (python 3.5), and both give me a blank plot without animation. However, each animation works perfectly well in Enthought Canopy. </p>
  
  <p>Is there something simple I'm missing when using spyder?</p>