matplotlib and no gui

Hi,
I'm trying to make a few matplotlib scripts work on a box without any
X. However, I would like to change it as little as possible and
therefore don't want to get rid of the pylab interface.

I almost got it to work already by just using the "dummy GUI", i.e. i
use

import matplotlib as m
m.use('Template')
import pylab as p

This works fine except for one little detail.

I've always had the problem that there doesn't seem to be a(n easy) way
to set the limits of a colour bar. However, as I need the colour scheme
to be constant across the different plots, I have always used the trick
of first plotting a 1x2 grid with the minimum and the maximum value and
then overwriting that with the actual plot. That way the colour bar
uses these values as it's extrema while these extrema are not
necessarily visible anywhere.

The problem I have now is that the overwriting doesn't work any more
with the trick of using the empty template for the GUI. Instead of
covering the existing pixels, they now show up in the bottom left
corner of my actual plot. If I remove that first plot, I lose my
constant colour bar but if I keep it, I have bogus pixels in my plot.

Any hints how to solve this dilemma?

Cheers,
Christian

Why not::

  import matplotlib
  matplotlib.use('Agg')

Then you have a full featured mpl backend w/ no GUI or X requirements.

···

On Wed, Jul 29, 2009 at 7:33 PM, Christian Lerrahn<lists@...1766...> wrote:

Hi,
I'm trying to make a few matplotlib scripts work on a box without any
X. However, I would like to change it as little as possible and
therefore don't want to get rid of the pylab interface.

I almost got it to work already by just using the "dummy GUI", i.e. i
use

import matplotlib as m
m.use('Template')
import pylab as p

Thanks for that! I had overlooked that backend. It seems to do the
trick perfectly. :slight_smile:

Cheers,
Christian

···

On Wed, 29 Jul 2009 20:43:43 -0500 John Hunter <jdh2358@...287...> wrote:

On Wed, Jul 29, 2009 at 7:33 PM, Christian > Lerrahn<lists@...1766...> wrote:
> Hi,
> I'm trying to make a few matplotlib scripts work on a box without
> any X. However, I would like to change it as little as possible and
> therefore don't want to get rid of the pylab interface.
>
> I almost got it to work already by just using the "dummy GUI", i.e.
> i use
>
> import matplotlib as m
> m.use('Template')
> import pylab as p

Why not::

  import matplotlib
  matplotlib.use('Agg')

Then you have a full featured mpl backend w/ no GUI or X requirements.

Great -- take a look at

  http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

which will explain the situation in much more detail. Also, the FAQ

  http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server

is useful even if you are not writing a webapp server, since the
issues of working in a non-X environment are similar to your case.

JDH

···

On Wed, Jul 29, 2009 at 9:05 PM, Christian Lerrahn<lists@...1766...> wrote:

Why not::

import matplotlib
matplotlib.use('Agg')

Then you have a full featured mpl backend w/ no GUI or X requirements.

Thanks for that! I had overlooked that backend. It seems to do the
trick perfectly. :slight_smile: