【发布时间】:2014-11-23 00:25:30
【问题描述】:
我正在尝试在我的 matplotlib 绘图中使用“Heuristica”字体,但它不会显示出来。
我在 rcParameter font.serif 的第一个位置定义了“Heuristica” --> 没有结果
我将 font.family 更改为“Heuristica”并收到消息
findfont: FontFamily not found
这让我开始思考,因为 Heuristica 已安装,我可以从其他软件毫无问题地访问它。所以我使用了 fontManager 并做了:
import pylab as pl
la = pl.matplotlib.font_manager.FontManager()
lu = pl.matplotlib.font_manager.FontProperties(family = 'Heuristica')
la.findfont(lu)
得到:
Out[7]: 'C:\\Windows\\Fonts\\Heuristica-Regular.otf'
显然可以找到 Heuristica。 我查找了可用的 ttf 字体 (How can i get list of font family(or Name of Font) in matplotlib),但 Heuristica 不在此列表中。
如果有任何帮助,我会很高兴。
【问题讨论】:
-
你用的是什么版本的mpl?
-
我使用的是 1.3.1 版
-
尝试更新到 1.4.0。如果这不起作用,请在 github 上提出问题
-
在 1.4.0 下问题依然存在。你确定这真的是 Github 的问题,而不是我电脑前的人的问题吗?关于 github 问题:我可以链接到这个问题还是复制粘贴?
-
请提供足够的信息是我们不必链接回 SO 的问题。这里的问题不稳定(由于编辑和删除)。请提供足够的详细信息,以便使用 Windows 机器的人可以重现它(包括您是否更改了 rcparam 文件和 full 回溯)。
标签: python matplotlib fonts