【发布时间】:2014-02-26 15:59:19
【问题描述】:
在运行以下最小示例时,我在 LaTeX 渲染的表达式中得到了奇怪的 J 形伪影。
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Times']})
rc('text', usetex=True)
rc(('xtick','ytick','axes'), labelsize=12.0)
rc(('legend'), fontsize=8.0)
fig=plt.figure(figsize=(4,3))
ax1 = fig.add_subplot(111)
ax1.plot([0,1],[0,1],label=r'$\propto x^1$')
ax1.set_xlabel(r'$x$')
ax1.set_ylabel(r'$\sum_i \chi_i$')
ax1.legend()
fig.tight_layout()
plt.savefig('minimal.pdf')
输出:
我怎样才能摆脱它们?
【问题讨论】:
-
这可能是因为您的系统上没有类似于
Times的具有适当符号的字体。如果删除设置字体系列的第一行rc会发生什么? (您的示例在我的系统上完美运行,值得。我猜'serif':['Times']正在为您提供 Times New Roman,它没有正确的符号。)
标签: python-3.x matplotlib latex