This seems more a LaTeX problem than an R problem. But can you provide us (an sample example of) the LaTeX code the yields the overfull box.
---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey ________________________________ Van: Lore M [mailto:tchiba...@hotmail.com] Verzonden: woensdag 15 april 2009 15:44 Aan: ONKELINX, Thierry; R Help Onderwerp: RE: [R] using Sweave, how to save a plot in a given size After few corrections, it does work. But I have several plots to include in my document and, because of those commands, they're all on the same line even if there are 20 plots. I mean that Latex doesn't car about textwidth anymore and I get an overfull box (too wide). What could I do to correct that ? Thanks. > Subject: RE: [R] using Sweave, how to save a plot in a given size > Date: Wed, 15 Apr 2009 13:55:57 +0200 > From: thierry.onkel...@inbo.be > To: tchiba...@hotmail.com; wolfgang.raffelsber...@igbmc.fr; > r-help@r-project.org > > Dear Lore, > > The easiest thing to do is to write a function that saves your plot to a file > and generates the latex code. > > <<label=fig1, fig=FALSE, result = tex>>= > pdf("fig1.pdf", width = wid, heigth = hei) > plot(1:10) > dev.off() > cat("\begin{figure}\") > cat("\includegraphics[width = ", wid, ", height = ", hei, "]{proj1-fig1}\"} > cat("\end{figure}") > @ > > HTH, > > Thierry > > -----Oorspronkelijk bericht----- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Lore M > Verzonden: woensdag 15 april 2009 13:46 > Aan: wolfgang.raffelsber...@igbmc.fr; R Help > Onderwerp: Re: [R] using Sweave, how to save a plot in a given size > > > Yes it works, but I still have a problem. > The thing is that I know the dimensions of my plot but in the R code, not in > the latex code. So I tried to do : > > \SweaveOpts{prefix.string=proj1} > > <<label=fig1,fig=T,include=F,width=\Sexpr{wid}, height=\Sexpr{hei}>>= > plot(1:10) > @ > > \begin{figure} > \includegraphics {proj1-fig1} %% show > \end{figure} > > But Latex doen't find the value of "wid" and "hei" when it creates the chunk > code. But in the Latex code, it works and I do have the right value for "wid" > and "hei". > > Lore. > > > > Date: Tue, 14 Apr 2009 12:42:16 +0200 > > From: wr...@titus.u-strasbg.fr > > To: tchiba...@hotmail.com > > CC: r-help@r-project.org > > Subject: Re: [R] using Sweave, how to save a plot in a given size > > > > Hi I do somthing like: > > > > \SweaveOpts{prefix.string=proj1} > > > > <<label=fig1,fig=T,include=F,width=8, height=12>>= > > plot(1:10) > > @ > > > > \begin{figure} > > \includegraphics {proj1-fig1} %% show > > \label{..} > > \end{figure} > > > > > > Wolfgang > > > > > > Lore M a écrit : > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > I'm trying to realise a repport with R and Latex (TeXnicCenter and Miktex > > > for Windows) using Sweave(). > > > I'd like to save my plots in a given size. How can I do that ? The code > > > is : > > > > > > \SweaveOpts{prefix.string = figs/plot, eps = FALSE, pdf = TRUE} > > > <<partI, echo=FALSE ,fig=TRUE, include=FALSE>>= > > > plotFunction() > > > @ > > > \includepdf[pages=-]{figs/plot-partI} > > > > > > When I use par(pin=c(width,height)), I get the plot with the right size > > > but saved in a too big pdf page (7in x 7in, the default size of the > > > window). > > > So I tried to change the size of the window with the command windows() > > > but then, Sweave can't save the plot correctly. > > > > > > Thanks everyone. > > > > > > Lore. ________________________________ Souhaitez vous « être au bureau sans y être » ? Oui je le veux ! <http://www.microsoft.com/france/windows/bts/default.mspx> Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.