Rmarkdown图的问题(PDF输出)

时间:2020-03-24 16:01:01

标签: r pdf r-markdown knitr

我在Rmarkdown的开头使用以下文本来获取一系列PDF格式的绘图。我有一个自定义函数来创建绘制p值的图。

fontsize: 7pt
output:
  pdf_document:
    fig_width: 20
    fig_height: 12
    fig_caption: yes
    toc: yes
  html_document:
    fig_caption: yes
    keep_md: yes
    theme: united
    toc: yes
date: '`r Sys.Date()`'

---


```{r setup, include = FALSE}
# knitr setup
knitr::opts_chunk$set(echo = TRUE, dev = 'pdf')

```


```{r options, echo = FALSE}
# knitr options
  knitr::opts_chunk$set(comment = NA,
    fig.path = '01_models_figures_paper1/',
    results = 'markup',
    fig.width = 20,
    fig.height = 12,
    out.width = 20,
    out.height = 12,
    error = TRUE,
    tidy = FALSE,
    message = FALSE,
    warning = FALSE,
    echo = FALSE)

问题在于,这些图已正确以PNG格式保存(在将其保存为PDF之前,我已经尝试过了),并且如果我在R Studio中放大了“图查看器”。这是所需的输出:

desired output with pvalues correctly displayed

但是,在PDF导出的文件中,p值全部被压碎,根本无法读取:

current output with pvalues incorrectly displayed

我很幸运地使用了上面的所有参数,也一直在阅读,但是找不到任何解决方法。

0 个答案:

没有答案
相关问题