Re: [R] Sweave: include a multi-page-pdf plot

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Sun, 27 Mar 2011 14:40:19 -0400

On 27/03/2011 1:12 PM, Alexander Engelhardt wrote:
> Hi,
> I'm just starting out with Sweave, and I can't get a plot(linmod) to
> display all four plots:
>
> << bild>>=
> x1<- runif(100)
> x2<- rexp(100)
> y<- 3 + 4*x1 + 5*x2 + rnorm(100)
>
> mod<- lm(y~x1+x2)
> plot(mod)
> @
>
> Some Text
>
> <<fig=TRUE>>=
> <<bild>>
> @
>
> This plots only the first image of the four-page plot.lm() result.
> I don't want to use par(mfrow=c(2,2)), but ideally I'd like to access
> each one of the four plots in a different section of my LaTeX-file.
>
> Can you tell me how to do this?

If you want 4 separate pages, you need 4 separate plots. You should change your code from plot(mod) to plot(mod, which=1), and then have 3 more code chunks containing

plot(mod, which=n)

where n is a number from 2 to 6. (The default is to use 2, 3, and 5.)

Duncan Murdoch



R-help_at_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. Received on Sun 27 Mar 2011 - 18:44:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Mar 2011 - 18:50:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive