I recently made the switch from using Sweave to Knitr in order to gain Knitr's ability to cache R code chunks. So far its been fairly straightforward except for one thing. I cannot seem to find an intelligent way to size the resulting figures. What I don't want:
-
To use globally set the figure size as a percentage of the text width as shown here. Some of my figures are entire pages, some are small inserts. Is there a way to do this on a figure by figure basis?
-
To have to manually set the fig.width and fig.height for every figure. Latex include graphics has a very convenient [width=0.8\textwidth,keepaspectratio=true] option that works really nicely for sizing images without ruining the proportions. Searching through the knitr chunk options I cant find anything similar to the keepaspectratio option. Is there such an option in knitr?
Best Answer
With a review of the knitr options in the documentation http://yihui.name/knitr/options/ the figures can be resized keeping the aspect ration and they can be rotated plus other options.
Note that each graphic is resized individually.