Hi In Sweave, how does one change the size of the plots? I tried using a hook: <<echo=FALSE, print=FALSE, fig=TRUE>>options(SweaveHooks=list(fig=function() ps.options(width=1))) library(graphics) pairs(iris) @ but this didn't change the size of the figure. How to make the figures a different size? -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
On Thu, 17 Nov 2005, Robin Hankin wrote:> Hi > > In Sweave, how does one change the size of the plots?Of the actual .eps or .pdf files or of the included figures in the paper? The former can be done easily via <<foo,fig=TRUE,height=4,width=8>> ... @ etc., the latter can be done most conveniently by setting something like \setkeys{Gin}{width=0.75\textwidth} in the LaTeX documentation. hth, Z> I tried using a hook: > > > <<echo=FALSE, print=FALSE, fig=TRUE>>> options(SweaveHooks=list(fig=function() ps.options(width=1))) > library(graphics) > pairs(iris) > @ > > but this didn't change the size of the figure. How to make the > figures a > different size? > > > > -- > Robin Hankin > Uncertainty Analyst > National Oceanography Centre, Southampton > European Way, Southampton SO14 3ZH, UK > tel 023-8059-7743 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
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: > > > <<echo=FALSE, print=FALSE, fig=TRUE>>> options(SweaveHooks=list(fig=function() ps.options(width=1))) > library(graphics) > pairs(iris) > @ > > but this didn't change the size of the figure. How to make the > figures a > different size? > > > > -- > Robin Hankin > Uncertainty Analyst > National Oceanography Centre, Southampton > European Way, Southampton SO14 3ZH, UK > tel 023-8059-7743 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read > the posting guide! http://www.R-project.org/posting-guide.html >
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 > >