Hi, I wish to use different colours for different arrows. Is this possible? -- Rajesh.J [[alternative HTML version deleted]]
Dear Rajesh, A quick reply to your questions concerning the diagram package To use different colors per arrow : just define arr.col as a matrix or a data.frame, and give the color number or name to each arrow: To use numbers: M <- matrix(nrow=4,ncol=4,data=0) M[2,1]<-1 ;M[4,2]<-2;M[3,4]<-3;M[1,3]<-4 pp<-plotmat(M,pos=c(1,2,1),curve=0.2,name=letters[1:4],lwd=1,box.lwd=2, cex.txt=0.8,arr.type="triangle",box.size=0.1,box.type="rect", box.prop=0.5,arr.len=0.6,arr.col=M) To use color names: arr.col <- as.data.frame(M) arr.col[2,1]<-"red" arr.col[4,2]<-"black" arr.col[3,4]<-"darkgreen" arr.col[1,3]<-"orange" pp<-plotmat(M,pos=c(1,2,1),curve=0.2,name=letters[1:4],lwd=1,box.lwd=2, cex.txt=0.8,arr.type="triangle",box.size=0.1,box.type="rect", box.prop=0.5, arr.len=0.8,arr.col=arr.col) Karline [[alternative HTML version deleted]]
Rajesh, A quick reply to your questions concerning the diagram package: To use different colors per arrow: just define arr.col as a Matrix or a data.frame, and give the color number or colorname to each arrow: To use numbers: M <- matrix(nrow=4,ncol=4,data=0) M[2,1]<-1 ;M[4,2]<-2;M[3,4]<-3;M[1,3]<-4 pp<-plotmat(M,pos=c(1,2,1),curve=0.2,name=letters[1:4],lwd=1,box.lwd=2, cex.txt=0.8,arr.type="triangle",box.size=0.1,box.type="rect", box.prop=0.5,arr.len=0.6,arr.col=M) To use color names: arr.col <- as.data.frame(M) arr.col[2,1]<-"red" arr.col[4,2]<-"black" arr.col[3,4]<-"darkgreen" arr.col[1,3]<-"orange" pp<-plotmat(M,pos=c(1,2,1),curve=0.2,name=letters[1:4],lwd=1,box.lwd=2, cex.txt=0.8,arr.type="triangle",box.size=0.1,box.type="rect", box.prop=0.5, arr.len=0.8,arr.col=arr.col) Karline