title: Force matplotlib to fully render plots in an IPython/Jupyter notebook cell before advancing to next cell
body: <p>In an IPython/Jupyter notebook I have a situation similar to the following pseudo code:</p>
  
  <pre><code>cell 1:
  run some computation
  plot several plots (separate figures)
  
  cell 2:
  run some computation
  plot several plots (separate figures)
  </code></pre>
  
  <p>This is working nicely, except for one annoyance. When I run both cells sequentially (Shift-enter, Shift-enter), the computation in the second cell starts running before the plots in the first cell are rendered and the plots for both cells are only rendered after the computation for both cells is completed. Just to be clear, the figures for the plots in the first cell are created immediately after the computation in the first cell is completed, but they remain empty until after the computation in the seconds cell is also completed.</p>
  
  <p>This would not be a huge problem except that if there is an uncaught exception in the second cell, which kills the computation for some reason, the plots in the first cell will never be rendered and the figures will remain empty.</p>
  
  <p>I am looking for a way to instruct matplotlib or jupyter (I am not sure where the issue is) at the end of cell 1 - finish rendering all outstanding plots before continuing code execution.</p>
  
  <p>I am using the <code>%matplotlib notebook</code> magic and matplotlib 1.5.3.</p>
  
  <p>Thanks!</p>