Segmentation fault with EPS output on matplotlib >=0.98.5.2

Hi All,

I’m trying to make a simple errorbar plot which gets saved to an EPS file. I paste the code below. For some weird reason, the savefig line causes a segmentation fault in ghostscript. when I use (in this case, on my computer) 206 points or more. It doesn’t happen if I comment the “pl.rc(‘text’, usetex=True)” line out nor does it happen if I comment the pl.savefig line out. This happens in matplotlib 0.99 and 0.98.5.2. Any help will be greatly appreciated.

Regards,

Ewald Zietsman

#test.py

import matplotlib.pyplot as pl
import numpy as np

pl.rc(‘text’, usetex=True)
pl.rc(‘font’, family=‘serif’)

N = 206
x1 = np.linspace(-10,10,N)
e1 = np.random.randn(N)

pl.errorbar(x1, x1, yerr=e1, fmt=‘k.’)
pl.savefig(‘test.eps’)
pl.show()

The error message:

python test.py
Segmentation fault
Traceback (most recent call last):
File “test.py”, line 16, in
pl.savefig(‘test.eps’)
File “/usr/lib/python2.5/site-packages/matplotlib/pyplot.py”, line 345, in savefig
return fig.savefig(*args, **kwargs)
File “/usr/lib/python2.5/site-packages/matplotlib/figure.py”, line 990, in savefig
self.canvas.print_figure(*args, **kwargs)
File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line 1419, in print_figure
**kwargs)
File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line 1308, in print_eps
return ps.print_eps(*args, **kwargs)
File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 869, in print_eps
return self._print_ps(outfile, ‘eps’, *args, **kwargs)
File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 892, in _print_ps
orientation, isLandscape, papertype)
File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 1148, in _print_figure_tex
else: gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”, line 1268, in gs_distill
your image.\nHere is the full report generated by ghostscript:\n\n’ + fh.read())
RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:

GPL Ghostscript 8.63 (2008-08-01)
Copyright © 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading CenturySchL-Roma font from /var/lib/defoma/gs.d/dirs/fonts/c059013l.pfb… 3423696 1832182 6023256 4166010 1 done.

I cannot reproduce this error.
And I'm not sure if this is a bug in matplotlib or ghostscript.
You may try to use different distiller.

pl.rc('ps', usedistiller="xpdf")

In my machine, both ghostscript and xpdf option works fine.
But my gs version is different than yours

GPL Ghostscript 8.61 (2007-11-21)

If the xpdf option woks, I think it is more likely that this is a bug in gs.

Regards,

-JJ

···

On Wed, Sep 2, 2009 at 9:22 AM, Ewald Zietsman<ewald.zietsman@...287...> wrote:

Hi All,

I'm trying to make a simple errorbar plot which gets saved to an EPS file. I
paste the code below. For some weird reason, the savefig line causes a
segmentation fault in ghostscript. when I use (in this case, on my computer)
206 points or more. It doesn't happen if I comment the "pl.rc('text',
usetex=True)" line out nor does it happen if I comment the pl.savefig line
out. This happens in matplotlib 0.99 and 0.98.5.2. Any help will be greatly
appreciated.

Regards,

Ewald Zietsman

#test.py

import matplotlib.pyplot as pl
import numpy as np

pl.rc('text', usetex=True)
pl.rc('font', family='serif')

N = 206
x1 = np.linspace(-10,10,N)
e1 = np.random.randn(N)

pl.errorbar(x1, x1, yerr=e1, fmt='k.')
pl.savefig('test.eps')
pl.show()

The error message:

python test.py
Segmentation fault
Traceback (most recent call last):
File "test.py", line 16, in <module>
pl.savefig('test.eps')
File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in
savefig
return fig.savefig(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in
savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1419, in print_figure
**kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1308, in print_eps
return ps.print_eps(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 869, in print_eps
return self._print_ps(outfile, 'eps', *args, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 892, in _print_ps
orientation, isLandscape, papertype)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1148, in _print_figure_tex
else: gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py",
line 1268, in gs_distill
your image.\nHere is the full report generated by ghostscript:\n\n' +
fh.read())
RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:

GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading CenturySchL-Roma font from
/var/lib/defoma/gs.d/dirs/fonts/c059013l.pfb... 3423696 1832182 6023256
4166010 1 done.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I’m using ‘xpdf’ now, I think it must be ghostscript acting up. I only need eps output infrequently so I’ll stick with this workaround for the moment.

···

On Mon, Sep 7, 2009 at 4:28 AM, Jae-Joon Lee <lee.j.joon@…287…> wrote:

I cannot reproduce this error.

And I’m not sure if this is a bug in matplotlib or ghostscript.

You may try to use different distiller.

pl.rc(‘ps’, usedistiller=“xpdf”)

In my machine, both ghostscript and xpdf option works fine.

But my gs version is different than yours

GPL Ghostscript 8.61 (2007-11-21)

If the xpdf option woks, I think it is more likely that this is a bug in gs.

Regards,

-JJ

On Wed, Sep 2, 2009 at 9:22 AM, Ewald Zietsman<ewald.zietsman@…287…> wrote:

Hi All,

I’m trying to make a simple errorbar plot which gets saved to an EPS file. I

paste the code below. For some weird reason, the savefig line causes a

segmentation fault in ghostscript. when I use (in this case, on my computer)

206 points or more. It doesn’t happen if I comment the "pl.rc(‘text’,

usetex=True)" line out nor does it happen if I comment the pl.savefig line

out. This happens in matplotlib 0.99 and 0.98.5.2. Any help will be greatly

appreciated.

Regards,

Ewald Zietsman

#test.py

import matplotlib.pyplot as pl

import numpy as np

pl.rc(‘text’, usetex=True)

pl.rc(‘font’, family=‘serif’)

N = 206

x1 = np.linspace(-10,10,N)

e1 = np.random.randn(N)

pl.errorbar(x1, x1, yerr=e1, fmt=‘k.’)

pl.savefig(‘test.eps’)

pl.show()

The error message:

python test.py

Segmentation fault

Traceback (most recent call last):

File “test.py”, line 16, in

pl.savefig('test.eps')

File “/usr/lib/python2.5/site-packages/matplotlib/pyplot.py”, line 345, in

savefig

return fig.savefig(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/figure.py”, line 990, in

savefig

self.canvas.print_figure(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line

1419, in print_figure

**kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py”, line

1308, in print_eps

return ps.print_eps(*args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”,

line 869, in print_eps

return self._print_ps(outfile, 'eps', *args, **kwargs)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”,

line 892, in _print_ps

orientation, isLandscape, papertype)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”,

line 1148, in _print_figure_tex

else: gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)

File “/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py”,

line 1268, in gs_distill

your image.\nHere is the full report generated by ghostscript:\n\n' +

fh.read())

RuntimeError: ghostscript was not able to process your image.

Here is the full report generated by ghostscript:

GPL Ghostscript 8.63 (2008-08-01)

Copyright (C) 2008 Artifex Software, Inc. All rights reserved.

This software comes with NO WARRANTY: see the file PUBLIC for details.

Loading CenturySchL-Roma font from

/var/lib/defoma/gs.d/dirs/fonts/c059013l.pfb… 3423696 1832182 6023256

4166010 1 done.


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day

trial. Simplify your report design, integration and deployment - and focus

on

what you do best, core application coding. Discover what’s new with

Crystal Reports now. http://p.sf.net/sfu/bobj-july


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users