Eduardo de Oliveira Horta
2011-Jan-11 19:06 UTC
[R] Alphabetic labels on multi-plot graphics
Is there a way to achieve lbl=c("a", "b", "c", "d") 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="")) } without having to use an object like 'lbl'? 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
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