[R] Setting default plot size in Sweave

Frank E Harrell Jr f.harrell at vanderbilt.edu
Thu Jun 25 23:47:04 CEST 2009


Dear Colleagues:

I have used

\SweaveOpts{prefix.string=plot, eps = FALSE, pdf = TRUE}
\SweaveOpts{width=5, height=4}

<<fig=T>>=
plot(...)
@

But the figure still has a width of 80% of the text width, the default 
set up by Sweave, which issues a LateX command in Sweave.sty of 
\setkeys{Gin}{.8\textwidth}.  Sweave.sty has a command 
\ifthenelse{\boolean{Sweave at gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}% 
but I don't know how to set some parameter 'gin' to prevent the setkeys 
from being executed.

I would like to be able to set the default graph dimensions at the start 
of the document and to only specify height and width inside <<>>= when I 
want to depart from that default.

Thanks for any assistance.

Frank
-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list