knitr: include figures in report *and* output figures to separate files

前端 未结 2 906
栀梦
栀梦 2020-12-05 12:05

Not only would I like my figures to appear in my knitr-generated report, but I would also like to output them to separate files, too. To do this, I have included code like t

相关标签:
2条回答
  • 2020-12-05 12:15

    Keyword dev='pdf' as explained by Yihui here http://yihui.name/knitr/options/

    Together with other options I have found useful:

    ```{r 'setup', echo = FALSE, cache = FALSE}
        opts_chunk$set(dev = c('pdf', 'png'), 
            fig.align = 'center', fig.height = 5, fig.width = 8.5, 
            pdf.options(encoding = "ISOLatin9.enc")) 
    ```
    
    0 讨论(0)
  • 2020-12-05 12:31

    Use the option self_contained: no if you are using html_document, or keep_tex: yes if you use pdf_document, so that rmarkdown will not remove the figure files after rendering the output document.

    0 讨论(0)
提交回复
热议问题