Save eps ghostscript error

Hi,

I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The following code produces the following error. Can anyone verify whether this a problem with my installation or with matplotlib?

import pylab as P
P.figure()
width=.4
x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146, 0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519, 0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()

/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>()
     246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
     247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
     249 P.close()
     250 raise

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc in savefig(*args, **kwargs)
     343 def savefig(*args, **kwargs):
     344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
     346 if Figure.savefig.__doc__ is not None:
     347 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc in savefig(self, *args, **kwargs)
     988 patch.set_alpha(0.0)
     989
--> 990 self.canvas.print_figure(*args, **kwargs)
     991
     992 if transparent:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc in print_figure(self, filename, *args, **kwargs)
      99 def print_figure(self, filename, *args, **kwargs):
     100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args, **kwargs)
     102 # Restore the current view; this is needed because the
     103 # artist contains methods rely on particular attributes

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
    1417 edgecolor=edgecolor,
    1418 orientation=orientation,
-> 1419 **kwargs)
    1420 finally:
    1421 self.figure.dpi = origDPI

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc in print_eps(self, *args, **kwargs)
    1306 from backends.backend_ps import FigureCanvasPS # lazy import
    1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
    1309
    1310 def print_pdf(self, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in print_eps(self, outfile, *args, **kwargs)
     867
     868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
     870
     871 def _print_ps(self, outfile, format, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in _print_ps(self, outfile, format, *args, **kwargs)
     893 else:
     894 self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,
--> 895 orientation, isLandscape, papertype)
     896
     897 def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w',

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in _print_figure(self, outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype)
    1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
    1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
    1039
    1040 if passed_in_file_object:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in xpdf_distill(tmpfile, eps, ptype, bbox)
    1311 shutil.move(psfile, tmpfile)
    1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
    1314 for fname in glob.glob(tmpfile+'.*'):
    1315 os.remove(fname)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in pstoeps(tmpfile, bbox)
    1362 Convert the postscript to encapsulated postscript.
    1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
    1365
    1366 epsfile = tmpfile + '.eps'

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc in get_bbox(tmpfile, bbox)
    1336 else:
    1337 raise RuntimeError('Ghostscript was not able to extract a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
    1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
    1340

RuntimeError: Ghostscript was not able to extract a bounding box.Here is the Ghostscript output:

GPL Ghostscript 8.70: Unrecoverable error, exit code 1

> /usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox()
    1337 raise RuntimeError('Ghostscript was not able to extract a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
    1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]

You code works okay with the current svn.

See if changing the distiller option makes any difference
("ps.usedistiller" in the rc file).

The best would be for you to upgrade to the recent release of
matplotlib if possible.

Regards,

-JJ

···

On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j.reid@...1974...> wrote:

Hi,

I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
following code produces the following error. Can anyone verify whether
this a problem with my installation or with matplotlib?

import pylab as P
P.figure()
width=.4
x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()

/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>()
246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
249 P.close()
250 raise

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
in savefig(*args, **kwargs)
343 def savefig(*args, **kwargs):
344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
346 if Figure.savefig.__doc__ is not None:
347 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
in savefig(self, *args, **kwargs)
988 patch.set_alpha(0.0)
989
--> 990 self.canvas.print_figure(*args, **kwargs)
991
992 if transparent:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
in print_figure(self, filename, *args, **kwargs)
99 def print_figure(self, filename, *args, **kwargs):
100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args,
**kwargs)
102 # Restore the current view; this is needed because the
103 # artist contains methods rely on particular attributes

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
1417 edgecolor=edgecolor,
1418 orientation=orientation,
-> 1419 **kwargs)
1420 finally:
1421 self.figure.dpi = origDPI

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_eps(self, *args, **kwargs)
1306 from backends.backend_ps import FigureCanvasPS # lazy
import
1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
1309
1310 def print_pdf(self, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in print_eps(self, outfile, *args, **kwargs)
867
868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
870
871 def _print_ps(self, outfile, format, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_ps(self, outfile, format, *args, **kwargs)
893 else:
894 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
--> 895 orientation, isLandscape, papertype)
896
897 def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype,
bbox=bbox)
1039
1040 if passed_in_file_object:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in xpdf_distill(tmpfile, eps, ptype, bbox)
1311 shutil.move(psfile, tmpfile)
1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
1314 for fname in glob.glob(tmpfile+'.*'):
1315 os.remove(fname)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in pstoeps(tmpfile, bbox)
1362 Convert the postscript to encapsulated postscript.
1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
1365
1366 epsfile = tmpfile + '.eps'

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in get_bbox(tmpfile, bbox)
1336 else:
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
1340

RuntimeError: Ghostscript was not able to extract a bounding box.Here is
the Ghostscript output:

GPL Ghostscript 8.70: Unrecoverable error, exit code 1

>
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox()
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks for looking at this. I upgraded to 99.1.1 (although the tar file was named 99.1.2) and I got the same error message. When I played with the ps.usedistiller option I found it only doesn't work when I set ps.usedistiller to xpdf. With False or ghostscript it works ok but gives me output with different page sizes. AFAIK xpdf is the way to go for publication quality graphics. Do you know how I can get it to work? Is it worth trying the svn version?

Thanks,
John.

Jae-Joon Lee wrote:

···

You code works okay with the current svn.

See if changing the distiller option makes any difference
("ps.usedistiller" in the rc file).

The best would be for you to upgrade to the recent release of
matplotlib if possible.

Regards,

-JJ

On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j.reid@...1974...> wrote:

Hi,

I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
following code produces the following error. Can anyone verify whether
this a problem with my installation or with matplotlib?

import pylab as P
P.figure()
width=.4
x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()

/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>()
    246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
    247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
    249 P.close()
    250 raise

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
in savefig(*args, **kwargs)
    343 def savefig(*args, **kwargs):
    344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
    346 if Figure.savefig.__doc__ is not None:
    347 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
in savefig(self, *args, **kwargs)
    988 patch.set_alpha(0.0)
    989
--> 990 self.canvas.print_figure(*args, **kwargs)
    991
    992 if transparent:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
in print_figure(self, filename, *args, **kwargs)
     99 def print_figure(self, filename, *args, **kwargs):
    100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args,
**kwargs)
    102 # Restore the current view; this is needed because the
    103 # artist contains methods rely on particular attributes

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
   1417 edgecolor=edgecolor,
   1418 orientation=orientation,
-> 1419 **kwargs)
   1420 finally:
   1421 self.figure.dpi = origDPI

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_eps(self, *args, **kwargs)
   1306 from backends.backend_ps import FigureCanvasPS # lazy
import
   1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
   1309
   1310 def print_pdf(self, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in print_eps(self, outfile, *args, **kwargs)
    867
    868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
    870
    871 def _print_ps(self, outfile, format, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_ps(self, outfile, format, *args, **kwargs)
    893 else:
    894 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
--> 895 orientation, isLandscape, papertype)
    896
    897 def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
   1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
   1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype,
bbox=bbox)
   1039
   1040 if passed_in_file_object:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in xpdf_distill(tmpfile, eps, ptype, bbox)
   1311 shutil.move(psfile, tmpfile)
   1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
   1314 for fname in glob.glob(tmpfile+'.*'):
   1315 os.remove(fname)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in pstoeps(tmpfile, bbox)
   1362 Convert the postscript to encapsulated postscript.
   1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
   1365
   1366 epsfile = tmpfile + '.eps'

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in get_bbox(tmpfile, bbox)
   1336 else:
   1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
   1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
   1340

RuntimeError: Ghostscript was not able to extract a bounding box.Here is
the Ghostscript output:

GPL Ghostscript 8.70: Unrecoverable error, exit code 1

>
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox()
   1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
   1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev _______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

My guess is that somehow the output format of bbox device in the
recent ghostscript has changed.

What kind of output do you get when you run

gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps

in your shell (replace "test.eps" with any eps file you have)

I get

GPL Ghostscript 8.61 (2007-11-21)
Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 71 214 541 578
%%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982

The last two lines are what matplotlib requires to work.

Meanwhile, can you test if following changes make things work?

In lib/matplotlib/backends/backend_ps.py, comment out following two
lines near the end of the function "xpdf_distill" (around line 1458 in
my code), i.e.,

    if eps:
        pstoeps(tmpfile, bbox)

It will not raise the error, but may give you a wrong bbox.

Regards,

-JJ

···

On Mon, Jan 11, 2010 at 3:11 PM, John Reid <j.reid@...1974...> wrote:

Thanks for looking at this. I upgraded to 99.1.1 (although the tar file
was named 99.1.2) and I got the same error message. When I played with
the ps.usedistiller option I found it only doesn't work when I set
ps.usedistiller to xpdf. With False or ghostscript it works ok but gives
me output with different page sizes. AFAIK xpdf is the way to go for
publication quality graphics. Do you know how I can get it to work? Is
it worth trying the svn version?

Thanks,
John.

Jae-Joon Lee wrote:

You code works okay with the current svn.

See if changing the distiller option makes any difference
("ps.usedistiller" in the rc file).

The best would be for you to upgrade to the recent release of
matplotlib if possible.

Regards,

-JJ

On Mon, Jan 11, 2010 at 8:35 AM, John Reid <j.reid@...1974...> wrote:

Hi,

I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
following code produces the following error. Can anyone verify whether
this a problem with my installation or with matplotlib?

import pylab as P
P.figure()
width=.4
x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()

/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>()
246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
249 P.close()
250 raise

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
in savefig(*args, **kwargs)
343 def savefig(*args, **kwargs):
344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
346 if Figure.savefig.__doc__ is not None:
347 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
in savefig(self, *args, **kwargs)
988 patch.set_alpha(0.0)
989
--> 990 self.canvas.print_figure(*args, **kwargs)
991
992 if transparent:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
in print_figure(self, filename, *args, **kwargs)
99 def print_figure(self, filename, *args, **kwargs):
100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args,
**kwargs)
102 # Restore the current view; this is needed because the
103 # artist contains methods rely on particular attributes

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
1417 edgecolor=edgecolor,
1418 orientation=orientation,
-> 1419 **kwargs)
1420 finally:
1421 self.figure.dpi = origDPI

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_eps(self, *args, **kwargs)
1306 from backends.backend_ps import FigureCanvasPS # lazy
import
1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
1309
1310 def print_pdf(self, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in print_eps(self, outfile, *args, **kwargs)
867
868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
870
871 def _print_ps(self, outfile, format, *args, **kwargs):

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_ps(self, outfile, format, *args, **kwargs)
893 else:
894 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
--> 895 orientation, isLandscape, papertype)
896
897 def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype,
bbox=bbox)
1039
1040 if passed_in_file_object:

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in xpdf_distill(tmpfile, eps, ptype, bbox)
1311 shutil.move(psfile, tmpfile)
1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
1314 for fname in glob.glob(tmpfile+'.*'):
1315 os.remove(fname)

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in pstoeps(tmpfile, bbox)
1362 Convert the postscript to encapsulated postscript.
1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
1365
1366 epsfile = tmpfile + '.eps'

/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in get_bbox(tmpfile, bbox)
1336 else:
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
1340

RuntimeError: Ghostscript was not able to extract a bounding box.Here is
the Ghostscript output:

GPL Ghostscript 8.70: Unrecoverable error, exit code 1

>
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox()
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Jae-Joon Lee wrote:

My guess is that somehow the output format of bbox device in the
recent ghostscript has changed.

What kind of output do you get when you run

gs -dBATCH -dNOPAUSE -sDEVICE=bbox test.eps

in your shell (replace "test.eps" with any eps file you have)

I get

GPL Ghostscript 8.61 (2007-11-21)
Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 71 214 541 578
%%HiResBoundingBox: 71.207998 214.811993 540.629984 577.169982

The last two lines are what matplotlib requires to work.

I get
GPL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 69 210 541 574
%%HiResBoundingBox: 69.155998 210.131994 540.203960 573.335983

which looks pretty similar to me

Meanwhile, can you test if following changes make things work?

In lib/matplotlib/backends/backend_ps.py, comment out following two
lines near the end of the function "xpdf_distill" (around line 1458 in
my code), i.e.,

    if eps:
        pstoeps(tmpfile, bbox)

It will not raise the error, but may give you a wrong bbox.

They were at line 1363. Now it works but with the wrong bbox as you predicted.

Thanks for help so far. Any more ideas? I'll try the svn if it is just a case of checking it out and compiling.

John.

Please try.
I don't think the current svn version will make any difference. But,
at least I can send you a patch that I think fix the problem so that
you can test it.
I'll post the patch here soon.

Regards.

-JJ

···

On Mon, Jan 11, 2010 at 6:49 PM, John Reid <j.reid@...1974...> wrote:

Thanks for help so far. Any more ideas? I'll try the svn if it is just a
case of checking it out and compiling.

When you check out the svn, please try to apply the patch attached.

patch -p1 < ps_distiller.patch

I hope this solves your problem.

Regards,

-JJ

ps_distiller.patch (3.85 KB)

···

On Mon, Jan 11, 2010 at 7:25 PM, Jae-Joon Lee <lee.j.joon@...287...> wrote:

On Mon, Jan 11, 2010 at 6:49 PM, John Reid <j.reid@...1974...> wrote:

Thanks for help so far. Any more ideas? I'll try the svn if it is just a
case of checking it out and compiling.

Please try.
I don't think the current svn version will make any difference. But,
at least I can send you a patch that I think fix the problem so that
you can test it.
I'll post the patch here soon.

Regards.

-JJ

Jae-Joon Lee wrote:

When you check out the svn, please try to apply the patch attached.

patch -p1 < ps_distiller.patch

I hope this solves your problem.

Thanks again for quick response. I've got the svn version and applied the patch. Now I get this error (with ps.usedistiller : xpdf):

** (python2.5:5948): WARNING **: IPP request failed with status 1280
Error: Missing or bad Type3 CharProc entry

An eps file is generated but I can't open it with okular or evince.

Regards,
John.

I'm afraid that there is not much I can help anymore.

Just in case, does the same error occur when my patch is not applied?

Is it an error or just a warning? If it is an error, can you post a
full traceback? I just want to know what step causes that.

Also, are you using the usetex mode? See if turning that on and off
make any difference.

Regards,

-JJ

···

On Tue, Jan 12, 2010 at 5:29 AM, John Reid <j.reid@...1974...> wrote:

Jae-Joon Lee wrote:

When you check out the svn, please try to apply the patch attached.

patch -p1 < ps_distiller.patch

I hope this solves your problem.

Thanks again for quick response. I've got the svn version and applied
the patch. Now I get this error (with ps.usedistiller : xpdf):

** (python2.5:5948): WARNING **: IPP request failed with status 1280
Error: Missing or bad Type3 CharProc entry

An eps file is generated but I can't open it with okular or evince.

Regards,
John.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Jae-Joon Lee wrote:

I'm afraid that there is not much I can help anymore.

Just in case, does the same error occur when my patch is not applied?

Is it an error or just a warning? If it is an error, can you post a
full traceback? I just want to know what step causes that.

Also, are you using the usetex mode? See if turning that on and off
make any difference.

I tried turning usetex on and it works just fine as far as I can see. Thanks for the help.

···

Regards,

-JJ

John,

Would you do me a favor and open a ticket for this? So that other
developers can take a look in the future.

Please specify the options you're using, e.g., distiller, usetex,
ghostscript version, etc.

Regards,

-JJ

···

On Wed, Jan 13, 2010 at 3:16 AM, John Reid <j.reid@...1974...> wrote:

Jae-Joon Lee wrote:

I'm afraid that there is not much I can help anymore.

Just in case, does the same error occur when my patch is not applied?

Is it an error or just a warning? If it is an error, can you post a
full traceback? I just want to know what step causes that.

Also, are you using the usetex mode? See if turning that on and off
make any difference.

I tried turning usetex on and it works just fine as far as I can see.
Thanks for the help.

Regards,

-JJ

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Jae-Joon Lee wrote:

John,

Would you do me a favor and open a ticket for this? So that other
developers can take a look in the future.

Have done:
https://sourceforge.net/tracker/?func=detail&aid=2931430&group_id=80706&atid=560720