I'm having an issue with the low-quality graph output when saving html_notebook
in R markdown.
I tried changing the dpi
and fig.retina
settings of the chunks but didn't see an impact. This only happens when rendering .nb.html
preview file. When I knit the document as an html file, I have a lot better quality. I'm attaching a comparison below:
I'm using html_notebook
markdown for interact with the code, and would like to have the ability to save at the maximum quality to be able to generate reports quickly (rather than knitting everything from scratch).
This is a reproducible example to be executed as an .rmd
file. Execute the code and save the .rmd
file to create .nb.html
. And then, knit to html to get the higher quality .html
file.
---
title: "Test"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
html_document:
df_print: paged
toc: yes
toc_depth: '3'
toc_float: yes
html_notebook:
toc: yes
toc_depth: "3"
toc_float: yes
---
# Plot
```{r, fig.width=4, fig.height=3}
suppressPackageStartupMessages(library(ggplot2))
ggplot(iris)+
geom_point(aes(x=Sepal.Width, y= Sepal.Length, color=Petal.Width))+
theme_minimal()
```
Any ideas on how to change this behavior?
Thanks so much!