How to use Cairo PNGs in R Markdown

前端 未结 2 1850
不知归路
不知归路 2021-02-19 02:19

There are many advantages to using Cairo to save R graphics (see here, for example). When saving PDFs, for instance, the cairo_pdf device correctly embeds custom fo

2条回答
  •  既然无缘
    2021-02-19 03:01

    As an alternative to @rmflight's answer using a piece of code at the top of each file, this can be achieved in the shell wrapper or Makefile that knits Rmarkdown files using the optional parameters to rmarkdown::render():

    R -e 'rmarkdown::render("foo.Rmd", "pdf_document", output_file="foo.pdf", runtime = "static", output_options = list(dpi = 300, dev.args = list(type = "cairo")))'
    

提交回复
热议问题