Re: [R] Multi-plot figures with different numbers of plots indifferent rows

From: Earl F. Glynn <efg_at_stowers-institute.org>
Date: Wed 30 Mar 2005 - 02:07:55 EST

"Anne York" <york@zipcon.net> wrote in message news:Pine.LNX.4.62.0503261316330.2758@sasquatch...

> par(mfrow=c(2,3)) #set up 2 rows x 3 colums
> plot(1:10) #plot 1
> plot(1:10) #plot 2
> plot(1:10) #plot 3
> par(mfg=c(2,2)) # start next plot at 2,2 instead of 2,1
> plot(1:10) # 4th plot

If you want to leave the last plot(s) in a such a figure blank, and continue on with another figure, how does that work?

For example:

par(mfrow=c(2,3)) #set up 2 rows x 3 columns

plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")

par(mfg=c(2,2)) # start next plot at 2,2 instead of 2,1 plot(1:40, main="Plot 4")
# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?

par(mfg=c(1,1))
plot(1:50, main="Plot 5")
plot(1:60, main="Plot 6")

If "par(mfg=c(1,1))" is left out, Plot 6 is on the next figure.

The "new=T" parameters seems like a possible solution, but gives this warning and is ignored:

     Warning messages:
     1: parameter "new" couldn't be set in high-level plot() function

par(mfrow=c(2,3)) #set up 2 rows x 3 columns

plot(1:10, main="Plot 1", new=T)
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")

par(mfg=c(2,2)) # start next plot at 2,2 instead of 2,1 plot(1:40, main="Plot 4")
# What if 5th plot is to start on next page?
# Why do plots 5 and 6 overlay plots 1 and 2 instead
# of being on a new page?

par(mfg=c(1,1))
plot(1:50, main="Plot 5", new=T)
plot(1:60, main="Plot 6")

How do I create a series of plots in one figure and control when a new figure is created? (without using dummy blank placeholder plots)

The example above is only for discussion. I really want to do this in a loop
and create 5 plots per figure, and repeat this for many pages in a PDF file.

Thanks for any insight on this.

efg

--
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research

______________________________________________
R-help@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
Received on Wed Mar 30 02:19:02 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST