首页 > 代码库 > R语言diagram包画订单状态流图

R语言diagram包画订单状态流图

代码如下:

library("diagram")#a  <- read.table(file="clipboard",header=TRUE)write.table(a,file="a.txt",sep=";")aa <- ac <- matrix(nrow=ncol(aa),ncol=ncol(aa),0)i <- 1while(i<=ncol(aa)){  j <- 1  while(j<=ncol(aa)){    if(2>3&&aa[i,j]<10){      aa[i,j] <- 0    }    if(aa[i,j]>0 && aa[j,i]>0){      c[i,j] <- c[j,i] <- 0.06    }        j <- j+1  }  i <- i+1  }c[1,10] <- 0.45c[6,1] <- 0.45c[15,1] <- 0.7c[1,15] <- 0.1c[1,6] <- -0.65c[1,7] <- -0.95c[7,1] <- 0.45c[7,5] <- 0.75c[5,7] <- -0.95c[11,5] <- 0.65c[12,5] <- -0.85c[12,10] <- -0.38c[10,12] <- 0.45c[10,7] <- -1.25c[10,15] <- 0.45c[14,12] <- 0.35c[14,11] <- 0.4c[11,10] <- -0.45c[5,14] <- 0.35c[5,6] <- 0.8c[3,5] <- 0.8c[5,2] <- -0.65col <- matrix(nrow=ncol(aa),ncol=1,"black")col[1]="red"col[5]="darkorchid"col[10]="darkorange"col2 <- matrix(nrow=ncol(aa),ncol=ncol(aa),"black")col2[,1]="red"col2[,5]="darkorchid"col2[,10]="darkorange"plotmat(aa, pos = c(1,4,5,4,1), curve = c,        box.lcol = col,arr.lcol=col2,        name = colnames(aa), lwd = 1.5, box.lwd = 2,        cex.txt = 0.8, box.cex = 0.7, box.size = 0.05,        arr.length = 0.5, box.type = "circle", box.prop = 1,        shadow.size = 0.01, self.cex = 0.6, my = -0.075, mx = -0.01,        relsize = 0.8, self.shiftx = c(0, 0, 0.125, -0.12, 0.125, 0),        self.shifty = 0, main = "上海一周订单状态流程图")