【问题标题】:New font error with Showtext in ggplot2ggplot2中Showtext的新字体错误
【发布时间】:2017-04-26 01:06:38
【问题描述】:

自从更新到R 3.4 的新版本后,我在使用showtext 打印ggplot 时出现了一个新错误。

library(ggplot2)
library(showtext)

font.add.google("Lato")

p1 <- ggplot(diamonds, aes(depth, price)) +
  geom_point() +
  theme_minimal(base_family = "Lato")

这通常可以打印情节:

showtext.auto()
ggsave(plot = p1, "trial.pdf")

但是我得到了

Saving 5.2 x 5.83 in image
Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y,  : 
  invalid font type
In addition: There were 50 or more warnings (use warnings() to see the first 50)

这是我的SessionInfo()

【问题讨论】:

  • 有趣——降级到以前的 R 版本解决了这个问题。
  • R 3.3.2 中的相同错误

标签: r ggplot2


【解决方案1】:

通过在 R 3.4 下重新安装 showtext 解决

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2019-08-24
  • 1970-01-01
  • 2021-02-04
  • 2011-05-04
  • 1970-01-01
  • 1970-01-01
  • 2016-08-04
  • 1970-01-01
相关资源
最近更新 更多