1

Every time I want to knit a html document, the plot quality isn't great. Is there a way to change the rendering engine in RStudio and produce better plotting?

I'm using RStudio v. 1.4 on Windows 10.

Phil
  • 7,287
  • 3
  • 36
  • 66
dzegpi
  • 554
  • 5
  • 14

1 Answers1

3

If you want to increase the resolution for all graphics, you can set the chunk option dpi parameter at the beginning of your Rmd:

   ```{r setup, include=FALSE}
knitr::opts_chunk$set(dpi=300)

Alternatively, you can selectively increase the dpi as part of the chunk options

    ```{r myplot, dpi = 300 ....}

Check out your results. The setting of dpi will also have an impact on the size of your labels/characters and you may want to resize them.

Ray
  • 2,008
  • 14
  • 21
  • 1
    Thank you, but doesn't solve my problem. I've found this piece of code in [another stackoverflow question](https://stackoverflow.com/questions/55009313/how-to-use-cairo-pngs-in-r-markdown): `knitr::opts_chunk$set(dev.args = list(png = list(type = "cairo")))` – dzegpi May 04 '21 at 13:32