韦恩图主要用于集合的计算,计算不同集合之间的交集,并集,补集等。可以绘制 2-7 个集合的运算,图形可以用圆形或者椭圆形表示。
- library(venn)
- listA <- read.csv("genes_list_A.txt",header=FALSE)
- A <- listA$V1
- listB <- read.csv("genes_list_B.txt",header=FALSE)
- B <- listB$V1
- listC <- read.csv("genes_list_C.txt",header=FALSE)
- C <- listC$V1
- listD <- read.csv("genes_list_D.txt",header=FALSE)
- D <- listD$V1
- listE <- read.csv("genes_list_E.txt",header=FALSE)
- E <- listE$V1
- x <- list(A,B,C,D,E)
- x
- venn(x)
- venn(x,ellipse = T)
- venn(x,ellipse = T,zcolor = 'red')
- venn(x,ellipse = T,zcolor = rainbow(5))
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 1)
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 0.1)
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 0.8)#透明度
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 0.5)
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 0.5,snames = c('Sample A','Sample B','Sample C','Sample D','Sample E'))
- venn(x,ellipse = T,zcolor = rainbow(5),opacity = 0.5,snames = c('Sample A','Sample B','Sample C','Sample D','Sample E'),
- col = 'red')
- venn(list(A,B,D,E),ellipse = F,zcolor = rainbow(5),opacity = 0.5)
- venn(list(B,D,E),ellipse = F,zcolor = rainbow(5),opacity = 0.5)
- F =sample(C,1000)
- venn(list(A,B,C,D,E,F),zcolor = rainbow(6))
- G =sample(C,1000)
- H =sample(C,1000)
- venn(list(A,B,C,D,E,F,G),zcolor = rainbow(6))
- venn(list(A,B,C,D,E,F,G,H),zcolor = rainbow(6))#画不了,只能画7个,一般5个最多了
- #这个时候可以百度下花瓣图,聚焦交集。
- venn(list(A,B,C,D),zcolor = rainbow(4))
- h <- venn(list(A,B,C,D),zcolor = rainbow(4))
- h
- example(venn)
复制代码
|