Thursday, November 29, 2012

Matplotlib without an X server

Short form, by running xvfb-run python

In a more detailed answer, you need to install xvfb first:

$ sudo apt-get install xvfb

And then, supposing a script like this that we save as

from matplotlib.pyplot import *


We then run it:

$ xvfb-run python
 There should be a file named graph.png that will look like:

 All from the console.

No comments: