3

In Pycharm

import matplotlib.pyplot as plt
plt.interactive(True)
plt.plot([1,2,3,4])

The figure showed up and disappeared instantly.

How to set the figure to keep showing?

2 Answers 2

3

Since you are in interactive mode the figure will not stay open. You may simply not use interactive mode,

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

or you may turn it off before showing the figure.

import matplotlib.pyplot as plt
plt.interactive(True)
plt.plot([1,2,3,4])
plt.ioff()
plt.show()
Sign up to request clarification or add additional context in comments.

Comments

2

Use plt.show(), i.e.:

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

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.