Improved visualisation (ggplot) resolution in Rmarkdown

One of the ever-nagging Rmd tortures is that with html and MS Word output the visualisations look … ahhhhmmm … shabby.

Found this to set the graphics device and resolution to give super results. Include the following in the Rmd setup code-chunk:

if (knitr::opts_knit$get("rmarkdown.pandoc.to") != "latex") {
  knitr::opts_chunk$set(dpi = 300, dev.args = list(type = "cairo"))
})

Works like a charm!

Avatar
Rainer Koelle
Head Operational ANS Performance

I am a pilot, air traffic controller, and engineer, and work for EUROCONTROL, Performance Review Unit. My research interests revolve around operational air navigation and/or air transportation system performance applying a mix of data science and system analytics. In a side role I am also interested in time-critical decision making applied in aviation security and critical infrastructure protection.

Next
Previous