title: How to animate a seaborn's heatmap or correlation matrix?
body: <p>I am relatively new to python (coming from Matlab). As one project, I am trying to create an animated plot of a correlation matrix over time. To make the plots nice, I am trying seaborn. I struggled to get the animation done at all (having issues with Matplotlib backend on a mac), but a very basic animation now works using this code from the web:</p>
  
  <pre><code>import numpy as np
  from matplotlib import pyplot as plt
  from matplotlib import animation
  
  nx = 50
  ny = 50
  
  fig = plt.figure()
  data = np.random.rand(nx, ny)
  im = plt.imshow(data)
  
  def init():
      im.set_data(np.zeros((nx, ny)))
  
  def animate(i):
      #xi = i // ny
      #yi = i % ny
      data = np.random.rand(nx, ny)
      im.set_data(data)
      return im
  
  anim = animation.FuncAnimation(fig, animate, init_func=init, frames=50, repeat = False)
  </code></pre>
  
  <p>Now, I was trying to adapt this to <code>seaborn</code>, but did not succeed. It seems that seaborn works on subplots and to animate these was far harder. The best thing I got once was a kind of recursive plot, where <code>seaborn.heatmaps</code> were plotted on top of each other. Also, the <code>im.set_data</code> method was not available. </p>
  
  <p>Any suggestions are highly appreciated.</p>