[R] Multi-plot figures with different numbers of plots indifferent rows
Earl F. Glynn
efg at stowers-institute.org
Tue Mar 29 18:07:55 CEST 2005
"Anne York" <york at zipcon.net> wrote in message
news:Pine.LNX.4.62.0503261316330.2758 at 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
More information about the R-help
mailing list