quantmod
quantmod copied to clipboard
How to increase the chart dpi
Description
I am using Rmarkdown to generate the html output. However, the charts created by quantmod seems to have low dpi. I have tried to set dpi=300 in Rmarkdown knitr setting, but it has no effect. Could you please help with this? How to get the better quality of figures from quantmod in Rmarkdown output? Thanks
It would make it a lot easier to help if you provide a minimal reproducible example (i.e. not your entire Rmd file) and the output you get (the html and/or saved image). It's not clear whether this is something that can be fixed in quantmod or something that needs to be addressed with how you're using rmarkdown.
Following [1] it is possible to adjust the dpi in Rmarkdown knitr with a configuration change:
out.format <- knitr::opts_knit$get("out.format")
img_template <- switch( out.format,
word = list("img-params"=list(fig.width=6,
fig.height=6,
dpi=150)),
{
# default
list("img-params"=list( dpi=150,
fig.width=6,
fig.height=6,
out.width="504px",
out.height="504px"))
} )
knitr::opts_template$set( img_template )
That might do the trick.
[1] https://stackoverflow.com/a/27321367
I'm closing this because we don't have a reproducible example and/or evidence that this is something that can be fixed by a change in quantmod.