R语言绘制维恩图
当前位置:以往代写 > 其他教程 >R语言绘制维恩图
2019-06-14

R语言绘制维恩图

R语言绘制维恩图

Gplots包


> library(gplots)


Loading required package: gtools


Loading required package: gdata


Attaching package: ‘gdata’


The following object(s) are masked from ‘package:utils’:


object.size


Loading required package: caTools


Loading required package: bitops


Loading required package: grid


Attaching package: ‘gplots’


The following object(s) are masked from ‘package:stats’:


lowess


> ##


> ## Example using a list of item indexes belonging to the


> ## specified group.


> ##


> A<- 1:20


> B<- 1:20


> C<- 2:20


> D<- 3:21


> input<-list(A,B,C,D)


> input


[[1]]


[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


[[2]]


[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


[[3]]


[1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


[[4]]


[1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21


> venn(input)


> A<- as.logical(rbinom(100, 1, 0.2))


> B<- as.logical(rbinom(100, 1, 0.7))


> C<- as.logical(rbinom(100, 1, 0.2))


> D<- as.logical(rbinom(100, 1, 0.1))


> input<-data.frame(A,B,C,D)


> venn(input)


> tmp <- venn(input, simplify=TRUE)


> tmp


num A B C D


0000 0 0 0 0 0


0001 1 0 0 0 1


0010 1 0 0 1 0


0011 0 0 0 1 1


0100 38 0 1 0 0


0101 8 0 1 0 1


0110 12 0 1 1 0


0111 0 0 1 1 1


1000 4 1 0 0 0


1001 0 1 0 0 1


1010 1 1 0 1 0


1011 0 1 0 1 1


1100 13 1 1 0 0


1101 1 1 1 0 1


1110 3 1 1 1 0


1111 0 1 1 1 1


>venn(input, showSetLogicLabel=TRUE)


> venn(input, universe=NULL, showSetLogicLabel=TRUE)


asbio包


> library(asbio)


Loading required package: plotrix


Attaching package: ‘plotrix’


The following object(s) are masked from ‘package:gplots’:


plotCI


Loading required package: vegan


This is vegan 1.17-2


Attaching package: ‘vegan’


The following object(s) are masked from ‘package:gtools’


permute


Loading required package: MASS


Loading required package: lmomco


Package lmomco (0.97.4) loaded.


Loading required package: cluster


Loading required package: boot


Attaching package: ‘boot’


The following object(s) are masked from ‘package:gtools’:


inv.logit, logit


Loading required package: akima


> Venn(A=.3,B=.2,AandB=.06)


limma包


> library(limma)


Warning message:


semi-transparency is not supported on this device: reported only once per page


> Y <- matrix(rnorm(100*6),100,6)


> Y[1:10,3:4] <- Y[1:10,3:4]+3


> Y[1:20,5:6] <- Y[1:20,5:6]+3


> design <- cbind(1,c(0,0,1,1,0,0),c(0,0,0,0,1,1))


> fit <- eBayes(lmFit(Y,design))


> results <- decideTests(fit)


> a <- vennCounts(results)


> print(a)


x1 x2 x3 Counts


[1,] 0 0 0 87


[2,] 0 0 1 9


[3,] 0 1 0 2


[4,] 0 1 1 2


[5,] 1 0 0 0


[6,] 1 0 1 0


[7,] 1 1 0 0


[8,] 1 1 1 0


attr(,”class”)


[1] “VennCounts”


> vennDiagram(a)


> vennDiagram(results,include=c(“up”,”down”),counts.col=c(“red”,”green”))


venneuler包


> library(venneuler)


Loading required package: rJava


> vd <- venneuler(c(A=0.3, B=0.3, C=1.1, “A&B”=0.1, “A&C”=0.2, “B&C”=0.1 ,”A&B&C”=0.1))


> plot(vd)


> m <- data.frame(elements=c(“1″,”2″,”2″,”2″,”3”), sets=c(“A”,”A”,”B”,”C”,”C”))


Warning message:


semi-transparency is not supported on this device: reported only once per page


> 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)))


Warning message:


semi-transparency is not supported on this device: reported only once per page


> # without weights


> v <- venneuler(m > 0)


> plot(v)


> v <- venneuler(m)


> plot(v)


Vennerable包


> library(Vennerable)


Loading required package: graph


Loading required package: RBGL


Loading required package: lattice


Attaching package: ‘lattice’


The following object(s) are masked from ‘package:boot’:


melanoma


Loading required package: RColorBrewer


Loading required package: reshape


Loading required package: plyr


Attaching package: ‘Vennerable’


The following object(s) are masked from ‘package:asbio’:


Venn


> Venn(n=3)


A Venn object on 3 sets named


1,2,3


000 100 010 110 001 101 011 111


1 1 1 1 1 1 1 1


> plot(Venn(n=3))


> data(StemCell)


> w <- Venn(Sets=StemCell[1:2])


> Weights(w)


00 10 01 11


0 219 875 404


> plot(w)


> Weights(w) <- 1:4


> plot(w)

    关键字:

在线提交作业