如何在我的计算机上使用我的字体库中的任何类型的字体(例如*otf或者*ttf)matplotlib?
我正在尝试在matplotlib图中使用字体"Heuristica",但它不会显示出来.
我在rcParameter font.serif的第一个地方定义了"Heuristica" - >没有结果
我将font.family改为"Heuristica"并得到了消息
findfont: FontFamily not found
Run Code Online (Sandbox Code Playgroud)
这让我思考,因为安装了Heuristica,我可以毫无问题地从其他软件访问它.所以我使用了fontManager并做了:
import pylab as pl
la = pl.matplotlib.font_manager.FontManager()
lu = pl.matplotlib.font_manager.FontProperties(family = 'Heuristica')
la.findfont(lu)
Run Code Online (Sandbox Code Playgroud)
得到了:
Out[7]: 'C:\\Windows\\Fonts\\Heuristica-Regular.otf'
Run Code Online (Sandbox Code Playgroud)
所以很明显可以找到Heuristica.我查找了可用的ttf-Fonts(如何获取matplotlib中的字体系列列表(或字体名称))但是Heuristica不在此列表中.
任何帮助我都会很高兴.
我需要以编程方式(在 Ubuntu 中)为我的应用程序安装数百种字体(在 Rails 上用 Ruby 开发),并在安装时跟踪安装的字体名称。
所以我需要 UBUNTU 中的一个工具或一些库,它将TTF 文件作为输入并提供字体名称作为输出。
即使 ruby 中有某种方法(GEM 或任何可以帮助的东西)来查找给定 TTF 文件的字体名称,也会有很大的帮助。
提前致谢。
我有这个代码:
labels_params = {"labels":{n: "" if n[0] == "." else n for n in G.nodes () },
"font_family":"sans-serif",
"alpha":.5,
"font_size":16 }
draw_networkx_labels (G, pos, **labels_params)
Run Code Online (Sandbox Code Playgroud)
我的问题是我希望能够在输出图形中显示超过2种字体.
我想知道如何检测"font_family"的所有可能条目.
我从Networkx浏览了FontManager的代码,我只看到了"sans-serif".
我在Ubuntu下的X11工作.
我对Matplpoltlib有一个奇特的任务,需要在标签内显示表情符号。我正在使用OS X,因此emoji对系统提供了很好的支持。但是,Matplotlib无法解决问题:目前,表情符号显示为空框。我正在使用Python 3,因此Unicode应该不是问题。谢谢
matplotlib ×4
fonts ×3
python ×3
networkx ×2
ubuntu ×2
emoji ×1
font-family ×1
python-3.x ×1
ruby ×1
truetype ×1