Minor vtkpython import conflict with matplotlib

This is James Phillips of http://zunzun.com, I'm in the

    > process of switching the site graphics from DISLIN to
    > matplotlib. I had some trouble pinning down why the Y
    > axis on my plots ws always in the wrong place, and thought
    > I'd pass along my findings to the mailing list.

    > If pylab is imported before vtk, everything works fine:

pylab starts the default backend GUI mainloop (if there is one) when
you call "show", and this may be conflicting with vtkpython. The
default matplotlib GUI for the src distribution is GTKAgg and
vtkpython may start tk??? This is a wild guess.

For something like zunzun, a web app server, I suggest not using pylab
at all, but the matplotlib API, which avoids all the magical things
that pylab does that can just be a pain in an app server.

  http://matplotlib.sf.net/faq.html#OO

See for example

  http://matplotlib.sf.net/examples/agg_oo.py

Let me know if this helps.

If you really want to use pylab, make sure you set Agg or some other
image backend as your default backend in your matplotlibrc file
(http://matplotlib.sf.net/matplotlibrc) or do the following before
importing pylab

    import matplotlib
    matplotlib.use('Agg')
    import pylab

Hope this helps. zunzun is amazing!!

JDH

For something like zunzun, a web app server, I suggest not using pylab
at all, but the matplotlib API, which avoids all the magical things
that pylab does that can just be a pain in an app server.
  http://matplotlib.sf.net/faq.html#OO
See for example
  http://matplotlib.sf.net/examples/agg_oo.py
Let me know if this helps.

Matplotlib newbie that I am, *anything* will doubtless
be of help. Thank you for the references.

zunzun is amazing!!

One day when I win the lottery and have money for
a serious server, it will really kick some major
mathematical tail. Until then it remains a hobby,
albeit with matplotlib a much prettier one.

     James Phillips
     http://zunzun.com

···

On Wed, Aug 03, 2005 at 05:33:35PM -0500, John Hunter wrote: