I'm have a looping script which plots (matplotlib) and then, after plotting, waits for raw_input before continuing. This would allow me to delete any figures I don't want/need before the loop continues.
I have tried a few different ways but they never seem to properly display the figures before continuing.
# test1
x = [1, 2, 3]
plt.ion() # turn on interactive mode
for loop in range(0,3):
    y = np.dot(x, loop)
    plt.figure()
    plt.plot(x,y)
    plt.show()
    _ = raw_input("Press [enter] to continue.")
^ This one plots the figure windows but shows nothing until the loop has ended
#test2
x = [1, 2, 3]
plt.ion() # turn on interactive mode
for loop in range(0,3):
    y = np.dot(x, loop)
    plt.figure()
    plt.plot(x,y)
    plt.pause(0.02)
    plt.show()
    _ = raw_input("Press [enter] to continue.")
^ This one plots the figures fine but then freezes and the figure window crashes when the raw_input opens. The windows return to normal (are usable and zoomable) again once the full loop has finished
I've looked into the plt.show(block=False) command but haven't had any progress
Any ideas?
N.b. This question is very similar to the question here but, as you can see from the examples above, I haven't managed to get it working using those answers (which suggested plt.ion() and plt.pause(0.2)
 
     
     
    