让文氏图更好地通过减少非重叠区域

问题描述 投票:2回答:2

我策划了使用的代码下面的维恩图。

# Venn Diagram
grid.newpage();
venn.plot4 <- draw.quad.venn(
    area1 = 849, area2 = 7181, area3 = 1776, area4 = 6254,
    n12 = 0, n13 = 849, n14 = 0, n23 = 927, n24 = 6254, 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")
    );
grid.draw(venn.plot4);

有许多非重叠区域(0)。能否请你建议如何根据重叠区域来调整几何形状?

编辑由考虑@ zx8754的建议后,我曾尝试使用venneuler包绘制。它看起来比以前更好的情节。但尽管如此,重叠区域A和C不反映实际的值(A应的C完全一部分)。我甚至不能看到的选项对情节地块编号。任何建议都欢迎。

# including the null values 
vd <- venneuler(c(A=849, B=7181, C=1776, D=6254, 
                  "A&B"=0, "A&C"=849, "A&D"=0, "B&C"=927, "B&D"=6254, "C&D"=0))
plot(vd)

我也曾尝试d3vennR包下面的代码

venn_tooltip(
    d3vennR(
        data = list(
            list(sets= list('A'), size= 849),
            list(sets= list('B'), size= 7181),
            list(sets= list('C'), size= 1776),
            list(sets= list('D'), size= 6254),
            list(sets= list('A','B'), size= 0),
            list(sets= list('A','C'), size= 849),
            list(sets= list('A','D'), size= 0),
            list(sets= list('B','C'), size= 927),
            list(sets= list('B','D'), size= 6254),
            list(sets= list('C','D'), size= 0)
        )
        ,layoutFunction = '
function(d) { return venn.venn(d, { initialLayout: venn.classicMDSLayout });}
  '
    ))

虽然有BC区域之间的重叠,我们可以看到有没有从输出重叠。请就如何纠正这一建议?

r venn-diagram
2个回答
1
投票

你是不是给venneuler那种输入的预计。它需要脱节的组合,但你已经与工会提供它。 A,例如,应该已经在你的榜样设置为0。

然而,我的包euler可以输入和还积数,虽然我不知道,一个欧拉图,甚至是适合您的图表,你会从下面的输出找到。

library(eulerr)

vd <- euler(c(A = 849, B = 7181, C = 1776, D = 6254, 
              "A&B" = 0, "A&C" = 849, "A&D" = 0, "B&C" = 927, "B&D" = 6254,
              "C&D" = 0),
            input = "union")

plot(vd, counts = TRUE)

enter image description here


0
投票

这看起来像一个非常适合我的包nVennR。这是您的数据为例,虽然有更方便的方式来输入数据:

library(nVennR)
myV <- createVennObj(nSets = 4, sNames = c('A', 'B', 'C', 'D'))
myV <- setVennRegion(myV, c('A', 'C'), 849)
myV <- setVennRegion(myV, c('B', 'C'), 927)
myV <- setVennRegion(myV, c('B', 'D'), 6254)
myPlot <- plotVenn(nVennObj = myV, setColors=c("orange", "red", "green", "blue"), opacity=0.2)

结果:

Euler diagram

© www.soinside.com 2019 - 2024. All rights reserved.