【问题标题】:R ggplot2 fonts issueR ggplot2字体问题
【发布时间】:2013-05-06 18:12:55
【问题描述】:

我正在尝试使用 ggplot2 让 xkcd 字体在 R 中工作。但是我遇到了一些问题。 这是我到目前为止所做的。 1) 从目录 ~/.fonts 中的 xkcd 站点安装“Humor Sans”字体 2)安装“extrafont”包。此安装工作顺利。 3) 加载库

library(extrafont)

但是,当我尝试导入字体时,出现以下错误。

> 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

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

编辑:运行 ubuntu 12.04

【问题讨论】:

    标签: r fonts ggplot2


    【解决方案1】:

    你试过了吗:

    font_import(paths = "~/.fonts", pattern="Humor Sans")
    

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

    【讨论】:

    • 运行 Ubuntu 12.04。那并没有解决问题。此外,它已经根据错误消息扫描该目录
    • 那么你应该在那个目录上显示 ls 的结果。错误消息还说没有与模式匹配。
    • 目录~/.fonts 中只有 Humor-Sans.ttf 文件。
    • 好吧,如果拼写为“Humor-Sans”,那么这就解释了为什么找不到“Humor Sans”的模式。
    猜你喜欢
    • 1970-01-01
    • 2021-04-30
    • 2016-06-29
    • 2021-11-29
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多