[R] Multiple plots in one window

Soyeon Kim yunni0731 at gmail.com
Wed Nov 17 17:56:30 CET 2010


Dear All,

I made a function which gives 3 plots in one window(I used
par(mfrow=c(1,3)) in the function).
Using that function 3 times, I want to produce 9 plots in one window.
I tried par(mfrow=c(3,1)) or par(mfrow=c(3,3)) but it didn't work.

For example,

pf <- function(p) {
  par(mfrow=c(1,3))
  plot(c(p:(p+10)),c(1:11))
  plot(c(p:(p+10)),c(2:12))
  plot(c(p:(p+10)),c(3:13))
}
p <- c(1:3)
 par(mfrow=c(3,1))
for(i in 1:3) {
  pf(p[i])
}

How can I produce 9 plots or 3*n plots when I use that function n times?

Thank you ahead,
Soyeon



More information about the R-help mailing list