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

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Wed 30 Mar 2005 - 08:37:43 EST

Hi

Earl F. Glynn wrote:
> "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.
```              c(0, 4, 0)))
plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
plot(1:40, main="Plot 4")
```

# new page!
plot(1:40, main="Plot 5")

Paul

```--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
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 08:43:07 2005

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