title: Animated title in matplotlib
body: <p>I can't figure out how to get an animated title working on a FuncAnimation plot (that uses blit). Based on <a href="http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/" rel="noreferrer">http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/</a> and <a href="https://stackoverflow.com/questions/6077017/python-matplotlib-quickly-updating-text-on-axes">Python/Matplotlib - Quickly Updating Text on Axes</a>, I've built an animation, but the text parts just won't animate. Simplified example:</p>
  
  <pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
  import matplotlib.animation as animation
  import numpy as np
  
  vls = np.linspace(0,2*2*np.pi,100)
  
  fig=plt.figure()
  img, = plt.plot(np.sin(vls))
  ax = plt.axes()
  ax.set_xlim([0,2*2*np.pi])
  #ttl = ax.set_title('',animated=True)
  ttl = ax.text(.5, 1.005, '', transform = ax.transAxes)
  
  def init():
      ttl.set_text('')
      img.set_data([0],[0])
      return img, ttl
  def func(n):
      ttl.set_text(str(n))
      img.set_data(vls,np.sin(vls+.02*n*2*np.pi))
      return img, ttl
  
  ani = animation.FuncAnimation(fig,func,init_func=init,frames=50,interval=30,blit=True)
  
  plt.show()
  </code></pre>
  
  <p>If <code>blit=True</code> is removed, the text shows up, but it slows way down. It seems to fail with <code>plt.title</code>, <code>ax.set_title</code>, and <code>ax.text</code>.</p>
  
  <p>Edit: I found out why the second example in the first link worked; the text was inside the <code>img</code> part. If you make the above <code>1.005</code> a <code>.99</code>, you'll see what I mean. There probably is a way to do this with a bounding box, somehow...</p>