[R] Automating Plot Commands using a Loop
Koraelus
koraelus at yahoo.com
Mon Nov 9 21:38:44 CET 2009
I have three matrices with the same row and column names, but different data.
e.g.
Data
Alpha Beta Gamma Delta
A .1 .2 .3 .4
B .2 .3 .4 .5
C .8 .9 .43 .13
D .13 .34 .34 .3
For each column, I would like to create a separate plot on a single window.
I currently am using the cmd-line:
windows()
par(mfrow=c(2,2))
plot(Data$Alpha,type="o",axes=F,ann=F,ylim=c(0,1))
axis(1,at=1:4,lab=c("A","B","C","D")
axis(2,at=.25*0:1)
plot(Data$Beta,type="o",axes=F,ann=F,ylim=c(0,1))
axis(1,at=1:4,lab=c("A","B","C","D")
axis(2,at=.25*0:1)
etc.
I would like to automate this as much as possible. I tried to write a
function, but clearly it would involve some sort of loop... I don't know how
to do anything like that.
Thanks,
koraelus
--
View this message in context: http://old.nabble.com/Automating-Plot-Commands-using-a-Loop-tp26273268p26273268.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list