R for VennDiagram中的“不可能”错误消息

时间:2018-07-09 18:13:20

标签: venn-diagram

尝试在R中使用VennDiagram时,我不断收到错误消息。以下是我发布的代码:

draw.quintuple.venn(area1 = 578, area2 = 519, area3 = 212, area4 = 402, area5 = 172, n12 = 366, n15 = 97, n13 =149, n14 = 284, n23 = 103, n24 = 202, n25 = 125, n35 = 31, n34= 12, n45 = 27, n123 = 80, n124 = 161, n125 = 84, n134 = 8, n135 = 25, n145 = 20, n234 = 5, n235 = 24, n245 = 21, n345 = 1, n1234 = 5, n1345 = 21, n1245 = 16, n1235 = 0, n2345 = 0, n12345 = 0, category = c("1", "2", "3", "4", "5"), lty = "blank", fill = c("skyblue", "pink1", "mediumorchid", "yellow", "orange"))

错误:

  

错误[2018-07-09 13:37:19]不可能:a11 <-n23-a21-a22-a24-   a26-a29-a30-a31产生负面积错误   draw.quintuple.venn(区域1 = 578,区域2 = 519,区域3 = 212,区域4 =   402,:不可能:a11 <-n23-a21-a22-a24-a26-a29-a30   -a31产生负面积

我在做什么错?

我再次检查并确保所有值均正确。

1 个答案:

答案 0 :(得分:0)

我认为该软件包没有充分的文档证明。查看源代码可以发现nxxxxx的含义并不明显。例如,n135的意思是“多少个元素属于至少组1、3和5”。当您要绘制图表时,程序包会计算其中n135个还属于其他组(即n1235n1345n12345)的数量并将其减去。 这里似乎正在发生的事情是,您将n135解释为“仅个元素属于集合1、3和5”(这也是我的猜测)。如果要直接使用这些数字,请输入:

draw.quintuple.venn(area.vector = c(578, 519, 212, 402, 172, 31, 97, 284, 366, 125, 103, 149, 12, 202, 27, 1, 25, 20, 161, 84, 24, 80, 8, 5, 21, 0, 21, 16, 0, 5, 0), category = c("1", "2", "3", "4", "5"), lty = "blank", fill = c("skyblue", "pink1", "mediumorchid", "yellow", "orange"), direct.area = T)

VennDiagram picture

数字的顺序直接来自源代码,我没有看到它的记录。让我们称a135为“只有2个,3个和5个元素”。考虑到这一点,顺序将是:

a1, a2, a3, a4, a5, a35, a15, a14, a12, a25, a23, a13, a34, a24, a45, a345, a135, a145, a124, a125, a235, a123, a134, a234, a245, a2345, a1345, a1245, a1235, a1234, a12345

如果您更喜欢使用n135表示法,则需要转换数据,以使n135 = a135 + a1235 + a1345 + a12345依此类推。就您而言,n135 = 25 + 0 + 21 + 0 = 36

尽管不是问题的一部分,但您也可以使用我的nVennR包进行比例表示。数字的顺序记录在帮助和vignette中,您也可以输入原始集而不是数字:

library(nVennR)
myV <- createVennObj(nSets = 5, sNames = c('1', '2', '3', '4', '5'), sSizes = c(0, 172, 402, 27, 212, 31, 12, 1, 519, 125, 202, 21, 103, 24, 5, 0, 578, 97, 284, 20, 149, 25, 8, 21, 366, 84, 161, 16, 80, 0, 5, 0))
myV <- plotVenn(nVennObj = myV, setColors = c("skyblue", "pink1", "mediumorchid", "yellow", "orange"), borderWidth = 0)

结果:

nVennR picture