Reputation: 5611
At the end of the last function I call in one of my programs, I have the following code to plot a simple color plot.
plt.figure()
plt.pcolormesh(X,Y,Z)
plt.colorbar()
plt.show()
Afterwords I return to main and my program is complete. The plot displays as expected, however when I go to close it using the x button in the corner (on ubuntu), my program doesn't end. It just hangs there with a process running. How can I correct this?
Upvotes: 36
Views: 24802
Reputation: 11
If anyone has citrix installed and is using linux it might be interupting matplotlib, I have no idea why this is but after days of searching uninstalling citrix fixed the problem.
Upvotes: 1
Reputation: 829
For interactive mode, You need this at the head of file:
import matplotlib
matplotlib.use("TkAgg")
Upvotes: 5
Reputation: 3273
your matplotlib might be running in non-interactive mode for some reason. I am not sure how to prevent that in your local configuration but if you add either this:
plt.ion()
or this:
matplotlib.interactive(True)
somewhere at the beginning of your script, it should change the behaviour of your plots.
Upvotes: 34