#导入R包
library(grid)
library(futile.logger)
library(VennDiagram)
#建立测试数据集
A = 1:150
B = c(121:170,300:320)
C = c(20:40,141:200)
Length_A<-length(A)
Length_B<-length(B)
Length_C<-length(C)
Length_AB<-length(intersect(A,B))
Length_BC<-length(intersect(B,C))
Length_AC<-length(intersect(A,C))
Length_ABC<-length(intersect(intersect(A,B),C))
#画两个交集
draw.pairwise.venn(area1=Length_A,area2=Length_B,cross.area=Length_AB
,category=c('A','B'),lwd=rep(1,1),lty=rep(2,2)
,col=c('red','green'),fill=c('red','green')
,cat.col=c('red','green')
,rotation.degree=90)
#画3个交集
draw.triple.venn(area1=Length_A, area2=Length_B, area3=Length_C
,n12=Length_AB, n23=Length_BC, n13=Length_AC, n123=Length_ABC
,lwd=2,lty=2,
,category = c('A','B','C')
,col=c('red','green','blue'),fill=c('red','green','blue')
,cat.col=c('red','green','blue')
,reverse = FALSE)
#四个、五个集合的draw.quad.venn、 draw.quintuple.venn
参数:lwd:线宽度, lty:线性, col:边缘颜色,fill:填充颜色 ,cat.col:字体颜色,rotation.degree:旋转角度