Running following code in an ipython/jupyter notebook:
for i in range(4):
    # any figure
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(range(i), range(i))
    fig.show()
    # do something that takes a long time:
    a = fib(500000)     
results in all the figures being visible at the same time (after the 4th loop).
How can I change my setup so that the figures become visible as soon as they have been calculated (before the next step in the for loop)?
N.B. I'm using %matplotlib inline
First, import display:
from IPython import display
and replace fig.show() by display.display(fig) 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With