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:]]