# Re: [R] How to make label in multi plot

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Mon 16 May 2005 - 13:36:57 EST

Hi

> Dear R-Help,
> As a reference about multi plot,
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48725.html
>
> I want to know how can I make a label for each row.
> I mean like,
>
> ------------ ------------- --------------
> | | | | | |
> Group A | plot1 | | plot 2 | | plot 3 |
> | | | | | |
> ------------- ------------- --------------
>
> -------------
> | |
> Group B | plot 4 |
> | |
> -------------
>

Two ways (at least):

(i) use an outer margin ...

ooma <- par(oma=c(0, 5, 0, 0))
layout(rbind(c(1, 2, 3),

c(0, 4, 0)))
plot(1:10, main="Plot 1")
olas <- par(las=2)

at=0.75)
par(olas)

```plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
plot(1:40, main="Plot 4")
```

olas <- par(las=2)

at=0.25)
par(olas)
# new page!
plot(1:40, main="Plot 5")
par(ooma)

(ii) create an extra row/coloumn in the layout for the labels:

layout(rbind(c(1, 2, 3, 4),

```              c(5, 0, 6, 0)),
widths=c(2, 5, 5, 5))
```

# "plot 1" is label for row 1
omar <- par(mar=rep(0, 4))
plot.new()
text(0.5, 0.5, "Group A", cex=2)
par(omar)
```plot(1:10, main="Plot 1")
plot(1:20, main="Plot 2")
plot(1:30, main="Plot 3")
```

# "plot 5" is label for row 2
omar <- par(mar=rep(0, 4))
plot.new()
text(0.5, 0.5, "Group B", cex=2)
par(omar)
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