[Tex/LaTex] Reducing R figure sizes in lyx


I am using LyX with the Sweave module to generate some R figures within a document. I can't seem to get the figures to be smaller, and they tend to take up half a page which is far too large.
I have tried:

 <<echo=F, fig=T, width=0.5, height=0.5>>=

bit it throws an error. Putting any value greater than 1 for width and height make my figure lines thick and font huge but the amount of space it takes up is essentially the same.

So is there anyway to make the output figures smaller?

Best Answer

Which version of LyX are you using? If you are using 2.0.3 (the newest stable version), you can use knitr which is more flexible, in my opinion. Note that you have to have knitr installed in R, which you can do by install.packages('knitr'). Then, in LyX, for the module instead of Sweave choose Rnw (knitr).

Once you have knitr installed in R and loaded in LyX, this works well for me:

<<chunk_name, fig.width=6.5, fig.height=4, background=NA>>=