matplotlib中错误的乳胶渲染 [英] Wrong latex rendering in matplotlib

查看:86
本文介绍了matplotlib中错误的乳胶渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

With python 2.7.12 (on Ubuntu 16.04), and matplotlib 1.5.2, the following code is rendered incorrectly:

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$,如下所示:

The xlabel renders as if it was $\partial i\Delta$ and the title renders as if it was $\rightharpoonup\Upsilon\partial$ as you can see here:

我的乳胶安装可以正常运行.知道是什么问题吗?

My latex installation is otherwise functional. Any idea what the problem is?

推荐答案

您可以在用户的指南,有关matplotlibrc文件:

# [...] When text.usetex is False,
# font.family may also be one or more concrete font names.

因此,您应该使用具体的font.family属性,或者只是将matplotlibrc文件中的text.usetex参数更改为True.

Therefore, you should use a concrete font.family property or just change the text.usetex parameter to True in the matplotlibrc file.

#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

这篇关于matplotlib中错误的乳胶渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆