title: matplotlib.pyplot/pylab not updating figure while isinteractive(), using ipython -pylab
body: <p>There are a lot of questions about matplotlib, pylab, pyplot, ipython, so I'm sorry if you're sick of seeing this asked.  I'll try to be as specific as I can, because I've been looking through people's questions and looking at documentation for pyplot and pylab, and I still am not sure what I'm doing wrong. On with the code:</p>
  
  <p>Goal: plot a figure every .5 seconds, and update the figure as soon as the plot command is called.</p>
  
  <p>My attempt at coding this follows (running on ipython -pylab):</p>
  
  <pre>
  <code>
  import time
  ion()
  x=linspace(-1,1,51)
  plot(sin(x))
  for i in range(10):
      plot([sin(i+j) for j in x])
      #see **
      print i
      time.sleep(1)
  print 'Done'
  </code>
  </pre>
  
  <p>It correctly plots each line, but not until it has exited the for loop.  I have tried forcing a redraw by putting <code>draw()</code> where <code>**</code> is, but that doesn't seem to work either.  Ideally, I'd like to have it simply add each line, instead of doing a full redraw.  If redrawing is required however, that's fine.</p>
  
  <p>Additional attempts at solving:
  <br>just after <code>ion()</code>, tried adding <code>hold(True)</code> to no avail.
  <br>for kicks tried <code>show()</code> for <code>**</code>
  <br>The closest answer I've found to what I'm trying to do was at <a href="https://stackoverflow.com/questions/2310851/plotting-lines-without-blocking-execution">plotting lines without blocking execution</a>, but <code>show()</code> isn't doing anything.  </p>
  
  <p>I apologize if this is a straightforward request, and I'm looking past something so obvious.  For what it's worth, this came up while I was trying to convert matlab code from class to some python for my own use.  The original matlab (initializations removed) which I have been trying to convert follows:</p>
  
  <pre><code>
  for i=1:time
      plot(u)
      hold on
      pause(.01)
      for j=2:n-1
          v(j)=u(j)-2*u(j-1)
      end
      v(1)= pi
      u=v
  end
  </code></pre>
  
  <p>Any help, even if it's just "look up this_method" would be excellent, so I can at least narrow my efforts to figuring out how to use that method.  If there's any more information that would be useful, let me know.</p>