Reputation: 387
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?
Upvotes: 3
Views: 3418
Reputation: 339735
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()
Upvotes: 3
Reputation: 99041
Use plt.show()
, i.e.:
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()
Upvotes: 2