1

我正在尝试使以下代码正常工作,以便在我的华夫饼图中显示字形 medkit 或 FontAwesome 字体中的任何其他图标。

library(waffle)
library(extrafont)

font_import()


loadfonts(device = "postscript")

它确实显示使用 postscriptFonts() 向 R 注册字体:FontAwesome

parts <- c(`Un-breached\nUS Population`=(318-11-79), `Premera`=11, `Anthem`=79)

waffle(parts/10, rows=3, colors=c("#969696", "#1879bf", "#009bda"),
   use_glyph="medkit", size=8)

当我运行 waffle 时,出现以下错误:

警告信息:

1: Removed 3 rows containing missing values (geom_text).

2: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y,  :
font family not found in Windows font database

我只是得到一个带有盒子的情节,其中缺少里面的图标。我在安装 fontawesome 或在 RStudio 中工作时缺少什么?

4

1 回答 1

1

所以经典的你把它拔掉了,然后把它插回去了……我重新启动了 RStudio,现在它可以工作了。

于 2018-03-26T04:44:58.437 回答