[R] Alphabetic labels on multi-plot graphics

David Winsemius dwinsemius at comcast.net
Tue Jan 11 21:08:46 CET 2011


On Jan 11, 2011, at 2:06 PM, Eduardo de Oliveira Horta wrote:

> Is there a way to achieve
>
> lbl=c("a", "b", "c", "d")
>
> opar <- par(mfrow=c(2,2), ann=FALSE)
> for (t in 1:4){
>  plot(seq(from=1,to=2*pi,length=100),
> sin(t*seq(from=1,to=2*pi,length=100)), type="l")
>  title(main=paste("(", lbl[t], ")", sep=""))
> }
> par(opar)

opar <- par(mfrow=c(2,2), ann=FALSE)
  for (t in 1:4){
   plot(seq(from=1,to=2*pi,length=100),
  sin(t*seq(from=1,to=2*pi,length=100)), type="l")
   title(main=bquote("("*.(letters[t])*")") )
  }
par(opar)

> without having to use an object like 'lbl'?

(You obviously need something from which to construct the titles.)

>
> More generally: is it possible to iteratively (as in a loop) add
> alphabetic titles to multi-plot graphics when the range over which 't'
> above varies is of an arbitrary length? It is important that
> ann=FALSE, because I don't want the axes labels.
>
> Thanks in advance, and best regards.
>
> Eduardo Horta
>
> ______________________________________________

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list