Backend

Must matplot be run with a backend installed suppose I only want to create a command line program and create plot and output as gif/jpg/png?

Because import is giving me errors seemingly in reference to x server:

from pylab import *
Traceback (most recent call last):
File “”, line 1, in ?
File “/usr/lib/python2.4/site-packages/pylab.py”, line 1, in ?
from matplotlib.pylab
import *
File “/usr/lib/python2.4/site-packages/matplotlib/pylab.py”, line 219, in ?
new_figure_manager, draw_if_interactive, show = pylab_setup()
File “/usr/lib/python2.4/site-packages/matplotlib/backends/init.py”, line 23, in pylab_setup

globals(),locals(),[backend_name])

File “/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py”, line 10, in ?
from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\

File “/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py”, line 7, in ?
import gtk; gdk = gtk.gdk
File “/var/lib/python-support/python2.4/gtk-2.0/gtk/init.py”, line 45, in ?

from _gtk import *

RuntimeError: could not open display

Timothy

Try the plain "Agg" backend rather than e.g. GTKAgg or TkAgg.

-- Asheesh.

···

On Fri, 17 Nov 2006, Timothy Wu wrote:

Must matplot be run with a backend installed suppose I only want to create a command line program and create plot and output as gif/jpg/png?

--
Ask not for whom the Bell tolls, and you will pay only the station-to-station
rate.
     -- Howard Kandel

import matplotlib
matplotlib.use('Agg')

from pylab import *

.....

···

On 11/17/06, Asheesh Laroia <asheesh@...1181...> wrote:

On Fri, 17 Nov 2006, Timothy Wu wrote:

> Must matplot be run with a backend installed suppose I only want to
> create a command line program and create plot and output as gif/jpg/png?

Try the plain "Agg" backend rather than e.g. GTKAgg or TkAgg.