使用 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$
标题渲染为 $\rightharpoonup\Upsilon\partial$
看这里:
我的 latex 安装在其他方面是正常的。知道问题出在哪里吗?
最佳答案
正如您在 User's Guide 中所读到的那样,关于matplotlibrc
文件:
# [...] When text.usetex is False,
# font.family may also be one or more concrete font names.
因此,您应该使用具体的 font.family
属性,或者只是将 中的
文件。text.usetex
参数更改为 True
matplotlibrc
#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
关于python - matplotlib 中错误的 latex 渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39337229/