나는 지난 몇 시간 동안 PGF 백엔드를 작동시키려고 노력했습니다. xelatex를 사용하려고 했는데 전혀 실행되지 않더군요.
이제 다음 예를 만들었습니다.
# -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use("pgf")
pgf_with_rc_fonts = {
"pgf.texsystem": "pdflatex"
}
mpl.rcParams.update(pgf_with_rc_fonts)
import matplotlib.pyplot as plt
plt.figure(figsize=(4.5,2.5))
plt.plot(range(5))
plt.savefig('figure.pgf')
오류가 발생합니다. 그것에 대해서는 잠시 후에 설명하겠습니다. 그러나 plt.savefig('Figure.pgf')를 제거하면 오류가 사라집니다. 터미널에서 반환되는 출력은 다음과 같습니다.
Traceback (most recent call last):
File "Dokumenter/fys2130/oblig4/test.py", line 13, in <module>
plt.savefig('figure.pgf')
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 577, in savefig
res = fig.savefig(*args, **kwargs)
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1470, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2194, in print_figure
**kwargs)
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py", line 835, in print_pgf
self._print_pgf_to_fh(fh, *args, **kwargs)
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py", line 814, in _print_pgf_to_fh
RendererPgf(self.figure, fh),
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py", line 422, in __init__
self.latexManager = LatexManagerFactory.get_latex_manager()
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py", line 232, in get_latex_manager
new_inst = LatexManager()
File "/home/marius/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_pgf.py", line 322, in __init__
raise LatexError("LaTeX returned an error, probably missing font or error in preamble:\n%s" % stdout)
matplotlib.backends.backend_pgf.LatexError: LaTeX returned an error, probably missing font or error in preamble:
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
restricted \write18 enabled.
**---! /home/marius/.texmf-var/web2c/pdftex/pdflatex.fmt doesn't match pdftex.pool
(Fatal format file error; I'm stymied)
내 matplotlib 버전은 1.4.2입니다.
제 질문은 이와 같은 문제를 해결하려면 어떻게 해야 합니까?입니다.
어디서부터 시작해야할지 모르겠습니다.