I have a .Rmd file and I am trying to create a .docx file via the function pandoc.
I want to have a figure with final resolution of 504x504 pixels (i.e., 7x7inch wi
It's most likely that since this question was asked, the software has improved. I came to this question looking for how to increase the resolution of plots. I found OP's original approach worked out-of-the-box for me.
So, setting dpi=300
(because dpi=150
did not produce a sufficiently obvious difference) in the chunk's parameters, produced a much higher quality image without modifying the physical size of the images within Word.
```{r, echo=FALSE, dpi=300, fig.width=7, fig.height=7}
plot(0,0,type="n",xlim=c(0,500), ylim=c(-12,0), las=1)
color <- rainbow(500)
text(380,-1,"Test",pos=4)
lseq <- seq(-6,-2,length.out=500)
for(j in seq_along(lseq)) {
lines(c(400,450), rep(lseq[j], 2), col=color[j])
}
polygon(c(400,450,450,400), c(-6,-6,-2,-2), lwd=1.2)
```
However, setting out.width
and out.height
removes the production of the image entirely, with the warning "fig.align, out.width, out.height, out.extra are not supported for Word output".