You are not logged in.

#1 2010-03-02 21:05:43

bioe007
Member
Registered: 2007-11-12
Posts: 56

python/matplotlib output using latex broken

ive been trying to:

pyplt.savefig("something.eps")

but i always get these errors:

Saving figure to: plots/large_study/res_FR.eps
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/mnt/data/sandbox/python/sqc_replacement/datawriter.py in <module>()
----> 1
      2
      3
      4
      5

/mnt/data/sandbox/python/sqc_replacement/datawriter.py in plot_residuals(params, ff)
    613             fname = 'plots' + os.sep + outfile + os.sep + 'res_' + p + '.' + ff
    614             print('Saving figure to: ' + fname)
--> 615             pyplt.savefig(fname, **{'format':ff})
    616         # 1}}}

    617

/usr/lib/python2.6/site-packages/matplotlib/pyplot.pyc in savefig(*args, **kwargs)
    354 def savefig(*args, **kwargs):
    355     fig = gcf()
--> 356     return fig.savefig(*args, **kwargs)
    357 if Figure.savefig.__doc__ is not None:
    358     savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/python2.6/site-packages/matplotlib/figure.pyc in savefig(self, *args, **kwargs)
   1030                 patch.set_alpha(0.0)
   1031
-> 1032         self.canvas.print_figure(*args, **kwargs)
   1033
   1034         if transparent:

/usr/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   1474                 orientation=orientation,
   1475                 bbox_inches_restore=_bbox_inches_restore,
-> 1476                 **kwargs)
   1477         finally:
   1478             if bbox_inches and restore_bbox:

/usr/lib/python2.6/site-packages/matplotlib/backend_bases.pyc in print_eps(self, *args, **kwargs)
   1327         from backends.backend_ps import FigureCanvasPS # lazy import
   1328         ps = self.switch_backends(FigureCanvasPS)
-> 1329         return ps.print_eps(*args, **kwargs)
   1330
   1331     def print_pdf(self, *args, **kwargs):

/usr/lib/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in print_eps(self, outfile, *args, **kwargs)
    853
    854     def print_eps(self, outfile, *args, **kwargs):
--> 855         return self._print_ps(outfile, 'eps', *args, **kwargs)
    856
    857

/usr/lib/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in _print_ps(self, outfile, format, *args, **kwargs)
    882             self._print_figure_tex(outfile, format, imagedpi, facecolor, edgecolor,
    883                                    orientation, isLandscape, papertype,
--> 884                                    **kwargs)
    885         else:
    886             self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,

/usr/lib/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype, **kwargs)
   1183         convert_psfrags(tmpfile, ps_renderer.psfrag, font_preamble,
   1184                         custom_preamble, paperWidth, paperHeight,
-> 1185                         orientation)
   1186
   1187         if rcParams['ps.usedistiller'] == 'ghostscript':

/usr/lib/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble, paperWidth, paperHeight, orientation)
   1270     if exit_status:
   1271         raise RuntimeError('LaTeX was not able to process your file:\
-> 1272 \nHere is the full report generated by LaTeX: \n\n%s'% fh.read())
   1273     else: verbose.report(fh.read(), 'debug')
   1274     fh.close()

RuntimeError: LaTeX was not able to process your file:
Here is the full report generated by LaTeX:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Arch Linux)
 restricted \write18 enabled.
entering extended mode
(/tmp/tmpQzkfCe.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty)
(/usr/share/texmf-dist/tex/latex/psnfss/mathptmx.sty)
(/usr/share/texmf-dist/tex/latex/psnfss/helvet.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty))
(/usr/share/texmf-dist/tex/latex/psnfss/courier.sty)
(/usr/share/texmf-dist/tex/latex/base/textcomp.sty
(/usr/share/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/share/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texmf-dist/tex/xelatex/xetexconfig/geometry.cfg)

Package geometry Warning: Over-specification in `h'-direction.
    `width' (578.15999pt) is ignored.


Package geometry Warning: Over-specification in `v'-direction.
    `height' (433.62pt) is ignored.

) (/usr/share/texmf-dist/tex/latex/psfrag/psfrag.sty
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texmf-dist/tex/latex/graphics/dvips.def)))
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty)
(/usr/share/texmf-dist/tex/latex/graphics/color.sty
(/usr/share/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texmf-dist/tex/latex/graphics/dvipsnam.def))
No file tmpQzkfCe.aux.
(/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf-dist/tex/latex/psnfss/ot1ptm.fd)
*geometry detected driver: dvips*
<tmpQzkfCe.eps> (/usr/share/texmf-dist/tex/latex/psnfss/ot1ztmcm.fd)
(/usr/share/texmf-dist/tex/latex/psnfss/omlztmcm.fd)
(/usr/share/texmf-dist/tex/latex/psnfss/omsztmcm.fd)
(/usr/share/texmf-dist/tex/latex/psnfss/omxztmcm.fd)
! Missing $ inserted.
<inserted text>
                $
l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

! Extra }, or forgotten $.
\mbox #1->\leavevmode \hbox {#1}

l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

! Extra }, or forgotten $.
\nfss@text #1->{\mbox {#1}}

l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

! Missing $ inserted.
<inserted text>
                $
l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

! Missing } inserted.
<inserted text>
                }
l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

! Missing } inserted.
<inserted text>
                }
l.47 \includegraphics*[angle=0]{tmpQzkfCe.eps}

[1] (./tmpQzkfCe.aux) )
(see the transcript file for additional information)
Output written on tmpQzkfCe.dvi (1 page, 5944 bytes).
Transcript written on tmpQzkfCe.log.

matplotlibrc:

backend : GTKAgg

font.family        : serif
font.serif         : Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman
font.sans-serif    : Helvetica, Avant Garde, Computer Modern Sans serif
font.cursive       : Zapf Chancery
font.monospace     : Terminus, Dina, Courier

text.usetex        : true
ps.usedistiller    : ghostscript

relevant packages:

extra/texlive-bibtexextra 2009.16287-1 (texlive-most)
extra/texlive-bin 2009.5-2
extra/texlive-core 2009.16776-1 (texlive-most)
extra/texlive-fontsextra 2009.16617-1 (texlive-most)
extra/texlive-formatsextra 2009.16044-1 (texlive-most)
extra/texlive-games 2009.16453-1 (texlive-most)
extra/texlive-genericextra 2009.15878-1 (texlive-most)
extra/texlive-htmlxml 2009.15878-1 (texlive-most)
extra/texlive-humanities 2009.16540-1 (texlive-most)
extra/texlive-latex3 2009.16491-1 (texlive-most)
extra/texlive-latexextra 2009.16666-1 (texlive-most)
extra/texlive-music 2009.15878-2 (texlive-most)
extra/texlive-pictures 2009.16576-1 (texlive-most)
extra/texlive-plainextra 2009.16629-1 (texlive-most)
extra/texlive-pstricks 2009.16633-1 (texlive-most)
extra/texlive-publishers 2009.16512-1 (texlive-most)
extra/texlive-science 2009.16539-1 (texlive-most)
extra/python-numpy 1.4.0-1
community/python-scipy 0.7.1-5
community/python-matplotlib 0.99.1.2-2

im pretty new to python, and i know nothing of latex, other than it seems to be well broken atm for me. i can save figures in any other file format with no errors.

Offline

#2 2010-03-02 21:18:11

csstaub
Member
From: Switzerland
Registered: 2009-02-09
Posts: 37

Re: python/matplotlib output using latex broken

Looks like the script is generating invalid LaTeX code. A bug perhaps?

Offline

#3 2010-03-02 22:07:00

bioe007
Member
Registered: 2007-11-12
Posts: 56

Re: python/matplotlib output using latex broken

csstaub wrote:

Looks like the script is generating invalid LaTeX code. A bug perhaps?

i've asked friends (other distros) and the folks in #scipy, noone else seems to have this problem.

i'd bet it has something to do wiht my setup, but im afraid idk enough to fix this problem.

Offline

Board footer

Powered by FluxBB