1

I want to show image during for iterations.

I encountered empty initial figure is generated during running.

however if i stop running the image appears.

What the problem is? I am using python 3.6.

    plt.ion()  # turn on interactive mode, non-blocking `show`
    for loop in range(0, 3):
        y = np.dot(x, loop)
        plt.figure()  # create a new figure
        plt.plot(x, y)  # plot the figure
        plt.show()  # show the figure, non-blocking
        _ = input("Press [enter] to continue.")  # wait for input from the user
        plt.close()
0

1 Answer 1

1

Just add a little pause after plt.show()

plt.show()
plt.pause(0.001)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.