Python matplotlib中的latex渲染错误

Python matplotlib中的latex渲染错误,python,matplotlib,latex,Python,Matplotlib,Latex,对于python 2.7.12(在Ubuntu 16.04上)和matplotlib 1.5.2,以下代码呈现不正确: from matplotlib.pyplot import * plot([1,2],[1,1]) xlabel(r"$\beta+1$") title(r'$\alpha > \beta$') show() xlabel的呈现方式类似于$\partial i\Delta$,而标题的呈现方式类似于$\righthharpoonup\Upsilon\partial$,如下

对于python 2.7.12(在Ubuntu 16.04上)和matplotlib 1.5.2,以下代码呈现不正确:

from matplotlib.pyplot import *
plot([1,2],[1,1])
xlabel(r"$\beta+1$")
title(r'$\alpha > \beta$')
show()
xlabel的呈现方式类似于
$\partial i\Delta$
,而标题的呈现方式类似于
$\righthharpoonup\Upsilon\partial$
,如下所示:

我的latex安装在其他方面是功能性的。知道问题出在哪里吗?

正如您在中所读到的,关于
matplotlibrc
文件:

# [...] When text.usetex is False,
# font.family may also be one or more concrete font names.
因此,您应该使用具体的
font.family
属性,或者在
matplotlibrc
文件中将
text.usetex
参数更改为
True

#text.usetex     : False  # use latex for all text handling. The following fonts
                          # are supported through the usual rc parameter settings:
                          # new century schoolbook, bookman, times, palatino,
                          # zapf chancery, charter, serif, sans-serif, helvetica,
                          # avant garde, courier, monospace, computer modern roman,
                          # computer modern sans serif, computer modern typewriter
                          # If another font is desired which can loaded using the
                          # LaTeX \usepackage command, please inquire at the
                          # matplotlib mailing list

你应该描述什么是“不正确”的意思(什么是预期行为,什么是实际行为),我认为很明显,在这种情况下,LaTeX渲染是不正确的。也就是说,在带有matplotlib 1.5.1的Mint上,结果是正确的(只是为了确保;这意味着,例如,“beta”实际上被渲染为“beta”;)工作正常(Latex正确渲染)在带有Python 2.7.11和Matplotlib 1.5.1的macOS上,在带有
Python 2.7.12
Matplotlib 1.5.2
的Arch Linux上运行良好,问题来自Matplotlib的rc参数:出于某种原因,在matplotlibrc文件中text.usetex被设置为False。把它变回现实解决了这个问题。