美文网首页R语言做生信
用R画韦恩图--最简单版本

用R画韦恩图--最简单版本

作者: 小洁忘了怎么分身 | 来源:发表于2018-12-21 15:45 被阅读23次

    if(!require(VennDiagram))install.packages('VennDiagram')
    library (VennDiagram)
    A <- c("C", "D", "B", "E")
    B <- c("C", "E", "B", "A")
    C <- c("C", "E", "X", "Y")
    venn.diagram(x= list(A = A,B = B,C = C),
    filename = "pic.png",
    height = 450, width = 450,
    resolution =300,
    imagetype="png",
    col="transparent",
    fill=c("green","yellow","darkorchid1"),
    alpha = 0.50,
    cex=0.45,
    cat.cex=0.45)
    参考http://blog.sciencenet.cn/blog-2985160-957210.html

    更新于2018.12.24 写成函数(今天写了好多函数开心)

    输入三个向量,最后一个参数是名字,根据实际情况修改

    venn <- function(x,y,z,name){
      if(!require(VennDiagram))install.packages('VennDiagram')
      library (VennDiagram)
      venn.diagram(x= list(Aff = x,Bio = y,Mine = z),
                   filename = paste0(name,".png"),
                   height = 450, width = 450,
                   resolution =300,
                   imagetype="png",
                   col="transparent",
                   fill=c("green","yellow","darkorchid1"),
                   alpha = 0.50,
                   cex=0.45,
                   cat.cex=0.45)
    }
    

    加标题的参数:main

    相关文章

      网友评论

        本文标题:用R画韦恩图--最简单版本

        本文链接:https://www.haomeiwen.com/subject/txtvkqtx.html