Take the 2-minute tour ×

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.


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?

share|improve this question
A quick and dirty solution might be to try using plt.draw() instead of plt.show(). show() loads all of the interactive tools, where draw() should be a simple viewer which may play more nicely with the rest of your program. –  jozzas Nov 26 '12 at 2:06
Also, which version of matplotlib are you using? Version 1.0.0 made some changes to show() to make it more compatible with what you want to do. See the docs for more info. –  jozzas Nov 26 '12 at 2:10
Are you using ipython, or some other matplotlib friendly console which handles the GUI threads correctly? –  DaveP Nov 26 '12 at 2:11
add comment

1 Answer

First off, are you sure that the program is hanging up on the plotting part? Have you tried placing debug statements after the line that says plt.show()? It would be helpful if you gave a little context of the program so that I can understand how the program is returned. Could you show us the code for the method call (even if its just pseudo-code)?

share|improve this answer
add comment

Your Answer


