R ggplot2字体问题

bro*_*oli 5 fonts r ggplot2

我试图让gkplot2中的xkcd字体在R中工作.但是我遇到了一些问题.这是我到目前为止所做的.1)从目录〜/ .fonts中的xkcd站点安装"Humor Sans"字体2)安装"extrafont"包.此安装工作顺利.3)加载库

library(extrafont)
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试导入字体时,我收到以下错误.

> font_import(pattern="Humor Sans")
 Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.
 Continue? [y/n] y
 Scanning ttf files in /usr/share/fonts/, ~/.fonts/ ...
 Extracting .afm files from .ttf files...
 Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) : 
 arguments imply differing number of rows: 0, 1
Run Code Online (Sandbox Code Playgroud)

关于我可能做错什么或我应该做什么的任何建议?非常感谢提前

编辑:运行ubuntu 12.04

42-*_*42- 1

你有没有尝试过:

font_import(paths = "~/.fonts", pattern="Humor Sans")
Run Code Online (Sandbox Code Playgroud)

在我看来,“~/.fonts”并不是 Mac 的默认字体文件夹,因此,如果这是(或不是)您的操作系统,则在编辑原始问题时应该包含更多详细信息。

  • 好吧,如果它被拼写为“Humor-Sans”,那么这就可以解释为什么“Humor Sans”的模式没有找到它。 (3认同)