9
这是我从功能我会在底部提供得到的错误:Matplotlib错误:乳胶无法处理以下字符串:“LP”
'latex' is not recognized as an internal or external command,
operable program or batch file.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\python27\lib\lib-tk\Tkinter.py", line 1486, in __call__
return self.func(*args)
File "C:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin
e 278, in resize
self.show()
File "C:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin
e 349, in draw
FigureCanvasAgg.draw(self)
File "C:\python27\lib\site-packages\matplotlib\backends\backend_agg.py", line
469, in draw
self.figure.draw(self.renderer)
File "C:\python27\lib\site-packages\matplotlib\artist.py", line 59, in draw_wr
apper
draw(artist, renderer, *args, **kwargs)
File "C:\python27\lib\site-packages\matplotlib\figure.py", line 1079, in draw
func(*args)
File "C:\python27\lib\site-packages\matplotlib\artist.py", line 59, in draw_wr
apper
draw(artist, renderer, *args, **kwargs)
File "C:\python27\lib\site-packages\matplotlib\axes\_base.py", line 2092, in d
raw
a.draw(renderer)
File "C:\python27\lib\site-packages\matplotlib\artist.py", line 59, in draw_wr
apper
draw(artist, renderer, *args, **kwargs)
File "C:\python27\lib\site-packages\matplotlib\axis.py", line 1116, in draw
renderer)
File "C:\python27\lib\site-packages\matplotlib\axis.py", line 1065, in _get_ti
ck_bboxes
extent = tick.label1.get_window_extent(renderer)
File "C:\python27\lib\site-packages\matplotlib\text.py", line 741, in get_wind
ow_extent
bbox, info, descent = self._get_layout(self._renderer)
File "C:\python27\lib\site-packages\matplotlib\text.py", line 311, in _get_lay
out
ismath=False)
File "C:\python27\lib\site-packages\matplotlib\backends\backend_agg.py", line
223, in get_text_width_height_descent
renderer=self)
File "C:\python27\lib\site-packages\matplotlib\texmanager.py", line 670, in ge
t_text_width_height_descent
dvifile = self.make_dvi(tex, fontsize)
File "C:\python27\lib\site-packages\matplotlib\texmanager.py", line 417, in ma
ke_dvi
report))
RuntimeError: LaTeX was not able to process the following string:
'lp'
Here is the full report generated by LaTeX:
这是我的功能“M使用创建上述错误:
def Derivative(inputArrayList,rowNumber_from_top):
for image in inputArrayList:
rowValues = image[0][rowNumber_from_top]
for i in range(len(rowValues)):
# Perform the difference derivative estimation
if i == 0 or i == (len(rowValues) - 1):
rowValues[ i ] = 0 # set edges to 0
else:
derivative = (rowValues[ i+1 ] - rowValues[ i-1 ])/(2.0)
rowValues[ i ] = derivative
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.plot(rowValues,color="k")
plt.ylim((0,image.max() + 10.0))
plt.title(r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$")
plt.show()
通知线路plt.title(r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$")
。我从first graph上Matplotlib的网站采取了这种(和我试着运行该程序,以及他们提供的),我似乎无法得到它的工作。我几乎肯定这是一个简单的修复(就像我可能缺少一个LaTeX模块或其他东西?)。
整个目标是能够使用命令\displaystyle
在标题和情节的标签,让分数变大。
我道歉,如果这是一个重复的(虽然我无法找到一个类似的问题),我只需要一个指针,让我朝着正确的方向发展。
谢谢您的时间,
布兰登
有没有经过“这里是乳胶生成完整的报告:”什么?你也可以看到,如果这是有帮助的:http://stackoverflow.com/questions/11354149/python-unable-to-render-tex-in-matplotlib –
@AmyTeegarden不幸的是,不,“后下面是生成的完整报告乳胶:'它是空白的。感谢您的链接!我会看看type1cm。 – bjd2385
你能直接处理在LaTeX的那条线,通过matplotlib没有运行?如果它不调用'\ displaystyle',你能处理它吗?你可以运行使用LaTeX的Matplotlib图库示例代码吗? – cphlewis