维恩图情节?

时间:2018-05-09 15:15:41

标签: r venn-diagram

我有一些数据如下,我想为他们安装Venn digram。如果有任何解决方案,请您告诉我。

dim(a)
1200

dim(b)
420

dim(c)
580

dim(d)
650

数据之间重叠:

a_b = 200
a_c=100
c_b=20
a_d= 11
b_d= 61
c_d= 0

2 个答案:

答案 0 :(得分:3)

构建ViennDiagram有多种方法。一种是使用VennDiagram包:

library(VennDiagram)
grid.newpage()
venn.plot <- draw.quad.venn(
  area1 = 1200,
  area2 = 420,
  area3 = 580,
  area4 = 650,
  n12 = 200,
  n13 = 100,
  n14 = 11,
  n23 = 20,
  n24 = 61,
  n34 = 0,
  n123 = 0,
  n124 = 0,
  n134 = 0,
  n234 = 0,
  n1234 = 0,
  category = c("a", "b", "c", "d"),
  fill = c("orange", "red", "green", "blue"),
  lty = "dashed",
  cex = 2,
  cat.cex = 2,
  cat.col = c("orange", "red", "green", "blue")
)

enter image description here

答案 1 :(得分:0)

有几种工具可以做到这一点。我开发了其中一个,叫做nVennR。根据您提供的数据,

library(nVennR)
cVenn <- createVennObj(4, c("a", "b", "c", "d"))
cVenn <- setVennRegion(cVenn, c("a", "b"), 200)
cVenn <- setVennRegion(cVenn, c("a", "c"), 100)
cVenn <- setVennRegion(cVenn, c("c", "b"), 20)
cVenn <- setVennRegion(cVenn, c("a", "d"), 11)
cVenn <- setVennRegion(cVenn, c("b", "d"), 61)
cFig <- plotVenn(nVennObj = cVenn)

Euler diagram

但是,您可以直接从列表a,b,c和d:

在一行中执行相同的操作
plotVenn(list(a=a, b=b, c=c, d=d))