In an IPython/Jupyter notebook I have a situation similar to the following pseudo code:
cell 1:
run some computation
plot several plots (separate figures)
cell 2:
run some computation
plot several plots (separate figures)
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.
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.
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.
I am using the %matplotlib notebook
magic and matplotlib 1.5.3.
Thanks!