【发布时间】:2021-08-30 08:50:12
【问题描述】:
当我在 Rstudio 的控制台中运行它时,我的绘图似乎没有任何问题,但是当我尝试使用 Rmarkdown 获取 PDF 输出时,代码出现错误:
library(tidyverse)
mtcars %>% ggplot(aes(x = mpg, y = cyl)) + geom_line() +
hrbrthemes::theme_modern_rc() +
labs(title = "Plot")
这是错误:
grid.Call.graphics 中的错误(C_text, as.graphicsAnnot(x$label), x$x, x$y, : invalid font type Calls: ... drawDetails -> drwDetails.text -> grid.Call.graphics Además:有 50 个警告(使用 warningswarnings() 查看第 50 个)Ejecución interrumpida
在 grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... 中: 在 Windows 字体数据库中找不到字体系列
我该如何解决这个问题?
【问题讨论】:
-
它有助于 SEO,如果您在文本中包含实际错误而不是图像,它将帮助其他读者:图像破坏了 SEO 和屏幕阅读器。请edit您的问题并添加文本本身(通常在代码块中)。谢谢。
-
尝试将
dev = "cairo_pdf"添加到块选项中。 -
控制台中的@r2evans 没有出现错误,但反正我写了。
-
@henrik_ibsen 非常感谢,这就是解决方案
标签: r ggplot2 plot r-markdown themes