venn diagram怎么做venn diagram怎么做
使用limma包 #安装limma包
#source('http://.bioconductor.org/biocLite.R')
#biocLite('limma')
#载入limma包
library(limma)
hsb2 《- read.table('http://.ats.ucla.edu/stat/R/notes/hsb2.csv',sep=',', header=T)
attach(hsb2)
hw 《- (write《=60)
hm 《- (math 《=60)
hr 《- (read 《=60)
c3 《- cbind(hw, hm, hr)
a 《- vennCounts(c3)
vennDiagram(a, include = 'both', names = c('High Writing', 'HighMath', 'High Reading'), cex = 1, counts.col = 'red')
使用gplots包 #安装gplots包
#install.packages('gplots')
#载入gplots包
library(gplots)
oneName 《- function()paste(sample(LETTERS,5,replace=TRUE),collapse='')
geneNames 《- replicate(1000, oneName())
GroupA 《- sample(geneNames, 400, replace=FALSE)
GroupB 《- sample(geneNames, 750, replace=FALSE)
GroupC 《- sample(geneNames, 250, replace=FALSE)
GroupD 《- sample(geneNames, 300, replace=FALSE)
input 《-list(GroupA,GroupB,GroupC,GroupD)
venn(input)
使用venneuler包 #安装venneuler包
#install.packages('venneuler')
#如果遇到rJava安装失败的问题,Ubuntu用户尝试可以通过以下方式解决
#sudo apt-get install r-cran-rjava
#载入venneuler包
library(venneuler)
m 《- data.frame(elements=c('1','2','2','2','3'),sets=c('A','A','B','C','C'))
v 《- venneuler(m)
plot(v)
m <- as.matrix(data.frame(A=c(1.5, 0.2, 0.4, 0, 0), B=c(0 , 0.2,0 , 1, 0), C=c(0 , 0 , 0.3, 0, 1)))
# without weights
v 《- venneuler(m > 0)
plot(v)
# with weights
v 《- venneuler(m)
plot(v)
使用VennDiagram包 #安装VennDiagram包
#install.packages('VennDiagram')
#载入VennDiagram包
library(VennDiagram)
venn.diagram(list(A=1:10,B=3:8,C=6:9),fill=c('red','green','blue'), alpha=c(0.5,0.5,0.5), cex=2,cat.fontface=4, fontfamily=3, filename='VennDiagram.tiff')
建议用后面三种方法,最多能画5 sets,limma方法最多只能画3 sets
参考资料 Calculates Venn and Euler Diagram
How can I generate a Venn diagram in R?
R绘图基础(五)文氏图vennDiagram
如何制作发表质量的Venn(维恩)图
Non-R Venn Diagrams
还有一些有趣的Venn图
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-48798-1.html
你们没注意罢了
质检局自己去买来检测的是假货