R语言做生信

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

2018-12-21  本文已影响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

上一篇下一篇

猜你喜欢

热点阅读