how to use X11, not the "Python" app, on Mac OS X?

Hello matplotlib-users,

I've just managed to get numpy, scipy, ipython and matplotlib running under ActivePython 2.5 on my Intel Mac.

But I'd like matplotlib to use just X11, and not the Aqua-wrapped thing with the rocket icon (app name "Python"): I want to be able to ssh -X into my mac, run ipython in an xterm, and see matplotlib figures in my X-window manager. At the moment, I've tried a few different matplotlib backends, but for some (WX, WXAgg, Tk) matplotlib pops up with its nice rocket icon on the physical screen of my mac, even when I'm sshing in from elsewhere, whereas for others (Agg, Agg2, Cairo), nothing pops up anywhere. Perhaps changing backends is not the right approach, and I should be doing something more fundamental...?

Apologies if I've missed something obvious---it's not a very searchable problem. Googling and/or searching this list for "macos x11 matplotlib" reveals that most people seem to want to go the other way and eliminate their dependency on X11.

Below I've pasted an example of what I've been trying, followed by my platform and installation info.

Thanks in advance for any pointers. cheers, --jez

backend = 'Cairo'
import matplotlib
matplotlib.use(backend)
import pylab,numpy
pylab.plot(numpy.arange(0,10))
pylab.show()

Mac OS X 10.4.11 on 2.16 GHz Intel Core 2 Duo
Python 2.5.2 (r252:60911, Mar 27 2008, 17:40:23)
  wget ‘http://downloads.activestate.com/ActivePython/macosx/2.5/ActivePython-2.5.2.2-macosx.dmg
  open ActivePython-2.5.2.2-macosx.dmg
numpy.__version__ = ‘1.1.0.dev5038’
  svn co http://svn.scipy.org/svn/numpy/trunk numpy
  cd numpy
  python setup.py build
  sudo python setup.py install
matplotlib.__version__ = ‘0.91.2’
  wget ‘http://surfnet.dl.sourceforge.net/sourceforge/matplotlib/matplotlib-0.91.2.tar.gz
  tar xfvz matplotlib-0.91.2.tar.gz
  cd matplotlib-0.91.2
  python setup.py build
  sudo python setup.py install
cairo.version = ‘1.4.12’
  sudo port install cairo # installed cairo 1.4.14
  wget ‘http://cairographics.org/releases/pycairo-1.4.12.tar.gz
  tar xfvz pycairo-1.4.12.tar.gz
  cd pycairo-1.4.12
  ./configure --prefix=`python -c “import sys; print sys.prefix”`
  make
  sudo make install

You need X11 based versions of Tcl/Tk and Python. I believe these are available through fink (or used to be), I build them from source. And then you can build matplotlib linking to these libraries (after tweaking setupext.py). It's somewhat involved but doable, actually you have to have a really good reason to do it. If you are still interested I can send you the gory details offline.

Nadia

Jeremy Hill wrote:

···

Hello matplotlib-users,

I've just managed to get numpy, scipy, ipython and matplotlib running under ActivePython 2.5 on my Intel Mac.

But I'd like matplotlib to use just X11, and not the Aqua-wrapped thing with the rocket icon (app name "Python"): I want to be able to ssh -X into my mac, run ipython in an xterm, and see matplotlib figures in my X-window manager. At the moment, I've tried a few different matplotlib backends, but for some (WX, WXAgg, Tk) matplotlib pops up with its nice rocket icon on the physical screen of my mac, even when I'm sshing in from elsewhere, whereas for others (Agg, Agg2, Cairo), nothing pops up anywhere. Perhaps changing backends is not the right approach, and I should be doing something more fundamental...?

Apologies if I've missed something obvious---it's not a very searchable problem. Googling and/or searching this list for "macos x11 matplotlib" reveals that most people seem to want to go the other way and eliminate their dependency on X11.

Below I've pasted an example of what I've been trying, followed by my platform and installation info.

Thanks in advance for any pointers. cheers, --jez

backend = 'Cairo'
import matplotlib
matplotlib.use(backend)
import pylab,numpy
pylab.plot(numpy.arange(0,10))
pylab.show()

Mac OS X 10.4.11 on 2.16 GHz Intel Core 2 Duo
Python 2.5.2 (r252:60911, Mar 27 2008, 17:40:23)
  wget 'http://downloads.activestate.com/ActivePython/macosx/2.5/ ActivePython-2.5.2.2-macosx.dmg'
  open ActivePython-2.5.2.2-macosx.dmg
numpy.__version__ = '1.1.0.dev5038'
  svn co http://svn.scipy.org/svn/numpy/trunk numpy
  cd numpy
  python setup.py build
  sudo python setup.py install
matplotlib.__version__ = '0.91.2'
  wget 'http://surfnet.dl.sourceforge.net/sourceforge/matplotlib/ matplotlib-0.91.2.tar.gz'
  tar xfvz matplotlib-0.91.2.tar.gz
  cd matplotlib-0.91.2
  python setup.py build
  sudo python setup.py install
cairo.version = '1.4.12'
  sudo port install cairo # installed cairo 1.4.14
  wget 'http://cairographics.org/releases/pycairo-1.4.12.tar.gz
  tar xfvz pycairo-1.4.12.tar.gz
  cd pycairo-1.4.12
  ./configure --prefix=`python -c "import sys; print sys.prefix"`
  make
  sudo make install

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options