[R] changing figure size in Sweave

TEMPL Matthias Matthias.Templ at statistik.gv.at
Thu Nov 17 15:01:43 CET 2005


Hi Robin,

After \begin{document} of your Rnw file, you can easily set e.g.

\setkeys{Gin}{width=width=0.8\textwidth}

And then doing something like;

<<test>>=
pdf(file = ...)
@

Best,
Matthias


> Hi Matthias
> 
> thanks for this.  I have the manual here.
> Do you have a working example of \setkeys{Gin}
> in use that I could modify?
> 
> best wishes
> 
> Robin
> 
> 
> On 17 Nov 2005, at 13:36, TEMPL Matthias wrote:
> 
> > The Sweave User Manual says (p. 12):
> >
> > Attention: One thing that gets easily confused are the width/height 
> > parameters of the R graphics devices and the corresponding 
> arguments 
> > to the LATEX \includegraphics command.
> > The Sweave options width and height are passed to the R graphics
> > devices, and hence affect
> > the default size of the produced EPS and PDF files. They do 
> not affect
> > the size of figures in the
> > document, by default they will always be 80% of the current text  
> > width.
> > Use \setkeys{Gin}
> > to modify figure sizes or use explicit \includegraphics commands in
> > combination with Sweave
> > option include=FALSE.
> >
> > I hope this helps.
> >
> > Best,
> > Matthias
> >
> >
> >>
> >> Hi
> >>
> >> In Sweave, how does one change the size of the plots?
> >>
> >> I tried using a hook:
> >>
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
>




More information about the R-help mailing list