Stop Matplot lib plot window pop-up

Most of the time I use matplotlib/pylab I want to see my graphs. When I don’t, I don’t want to see the plot window pop-up and vanish hundreds of times. To prevent the window from appearing add the following to the head of the script:

import matplotlib
matplotlib.use('Agg')

When calling savefig() instead of show() the window won’t appear – yey.

Advertisements

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s