zoukankan      html  css  js  c++  java
  • R语言diagram包画订单状态流图

    代码如下:

    library("diagram")
    
    #a  <- read.table(file="clipboard",header=TRUE)
    write.table(a,file="a.txt",sep=";")
    
    aa <- a
    
    c <- matrix(nrow=ncol(aa),ncol=ncol(aa),0)
    i <- 1
    while(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.45
    c[6,1] <- 0.45
    c[15,1] <- 0.7
    c[1,15] <- 0.1
    c[1,6] <- -0.65
    c[1,7] <- -0.95
    c[7,1] <- 0.45
    c[7,5] <- 0.75
    c[5,7] <- -0.95
    c[11,5] <- 0.65
    c[12,5] <- -0.85
    c[12,10] <- -0.38
    c[10,12] <- 0.45
    c[10,7] <- -1.25
    c[10,15] <- 0.45
    c[14,12] <- 0.35
    c[14,11] <- 0.4
    c[11,10] <- -0.45
    c[5,14] <- 0.35
    c[5,6] <- 0.8
    c[3,5] <- 0.8
    c[5,2] <- -0.65
    col <- 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 = "上海一周订单状态流程图")
    

      

  • 相关阅读:
    Spring使用@Value注解各种类型的值
    Jdom生成xml文件时的特殊字符问题
    将博客搬至CSDN
    ubuntu/mint添加字体
    linux保持ssh连接
    servlet 重定向与转发区别
    u盘写保护
    修改默认终端
    sudo apt-get update 无法获得锁
    logback多线程日志MDC
  • 原文地址:https://www.cnblogs.com/melodyluo/p/3921750.html
Copyright © 2011-2022 走看看