savefig problems with matplotlib

I have intermittent problems with the savefig(‘foo.eps’) command when I
am using my native LaTeX interpreter to produce eps files. The
really frustrating thing is that it is intermittent. Sometimes I
can save a file that looks fine and sometimes I can’t.

My box is running Fedora Core 4 and kernel 2.6.14.

I have the following rpms:
python-2.4.1-2
ipython-0.6.15-1.fc4
python-tools-2.4.1-2
python-matplotlib-0.84-1.fc4
python-numeric-23.7-2

Fedora has an out of date ghostscript 7.07, so I installed
ghostscript-8.51 from source into /usr/local, but not the fonts, since
they seemed unnecessary.

As long as I don’t use

rc(‘text’, usetex=True)

I’m ok, but whenever I turn it on, it doesn’t work consistently.

Here’s some sample code to demonstrate the problem. If I comment out the rc line, it works fine.

#!/usr/bin/env python

from matplotlib import rc
from matplotlib.numerix import arange, cos, pi
from pylab import *

forces = [1, 2, 3, 4]
pofn = [.2, .09, .01, .005]

rc(‘text’, usetex=True)
figure(1)
semilogy(forces,pofn,‘k’)
xlabel(r’$f_n = F_n/\langle F_n \rangle$’)
ylabel(r’$P(f_n)$’)
axis([0,5,.001,1])

savefig(‘mtest1.eps’)

However, if I run it as is, then I get the following:

[jwlandry@…897… hopper]$ ./mat-test.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
$HOME=/home/jwlandry
CONFIGDIR=/home/jwlandry/.matplotlib
loaded rc file /home/jwlandry/.matplotlib/matplotlibrc
matplotlib version 0.84
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.7
font search path [’/usr/share/matplotlib’]
loaded ttfcache file /home/jwlandry/.matplotlib/ttffont.cache
backend GTK version 2.6.2

This is dvips(k) 5.95a Copyright 2005 Radical Eye Software (www.radicaleye.com)
’ TeX output 2005.11.25:1645’ -> e0dab64d0b15f2821ec713a6e7903ff4.ps
<tex.pro><psfrag.pro><texps.pro><special.pro><
color.pro
>. <cmr8.pfb>
<cmsy8.pfb><cmsy10.pfb><cmmi8.pfb><cmmi10.pfb><cmr10.pfb>[1
<e0dab64d0b15f2821ec713a6e7903ff4.eps>]

When it doesn’t work, a dialog box opens with this message

Save figure failure:
None: Interrupted system call

Help!

James Landry

···


James W. Landry
jwlandry@…287…