title: Display numpy array in a for loop using matplotlib imshow
body: <p>I have a numpy array whose elements are updated in a for loop:</p>
  
  <pre><code>a = np.array([[1,2,3],[4,5,6],[7,8,9]])
  
  for t in range(0,10):
      imshow(a)
  
      for i in range(0,a.shape[0]):
          for j in range(0,a.shape[1]):
              a[i][j] += 1
  </code></pre>
  
  <p>I want to display the array at each iteration, but imshow() doesn't work, it just displays the image once the loop terminates.</p>
  
  <p>ps. I'm using an Ipython notebook</p>
  
  <p>I found different things on the web but none of them work on my computer (for example I tried to use matplotlib's animation module)</p>
  
  <p>The strange thing is that if I try to execute this example (<a href="http://matplotlib.org/examples/animation/dynamic_image2.html" rel="noreferrer">http://matplotlib.org/examples/animation/dynamic_image2.html</a>) using the standard python prompt everything works fine, while on the Ipython notebook it doesn't work. Can anyone explain me why?</p>
  
  <p><strong>notes:</strong></p>
  
  <p>Maybe I oversimplified my code; </p>
  
  <p>I'm working on a forest-fire model, the array is a grid filled with 0 = empty site, 1 = tree, 2 = fire.</p>
  
  <p>At each time step (iteration):</p>
  
  <ol>
  <li>a tree is dropped on a randomly chosen site and if the site is free the tree is planted</li>
  <li>a tree ignites with a probability f </li>
  </ol>
  
  <p>I want to display the array using a colormap to visualize the evolution of my model</p>