繁体   English   中英

在matplotlib中错误的乳胶渲染

[英]Wrong latex rendering in matplotlib

使用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$ ,你可以在这里看到: 产量

我的乳胶安装功能正常。 知道问题是什么吗?

您可以在“ 用户指南”中阅读有关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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM