如何在三重维恩图中打开缩放?

huangapple go评论59阅读模式
英文:

How to turn on the scaling in a triple Venn diagram?

问题

grid.newpage() # 移动到新的绘图页面
draw.triple.venn(area1 = 153, # 每个集合使用不同的颜色
area2 = 173,
area3 = 224,
n12 = 2,
n23 = 26,
n13 = 8,
n123 = 140,
col = "red",
fill = c("pink", "green", "orange"), scaled = TRUE)

英文:

I am trying to build the following diagram but while it must be possible (see the picture), I have an error about the negative area.

I also need my diagram scaled.

如何在三重维恩图中打开缩放?

grid.newpage()                                        # Move to new plotting page
draw.triple.venn(area1 = 153,                          # Different color for each set
                 area2 = 173,
                 area3 = 224,
                 n12 = 2,
                 n23 = 26,
                 n13 = 8,
                 n123 = 140,
                 col = "red",
                 fill = c("pink", "green", "orange"), scaled = TRUE)

答案1

得分: 2

library(VennDiagram)
grid.newpage()                                        # 移至新的绘图页面
draw.triple.venn(area1 = 153,                          # 每个集合的面积
                 area2 = 173,
                 area3 = 224,
                 n12 = 142,
                 n23 = 166,
                 n13 = 148,
                 n123 = 140,
                 col = "red",
                 fill = c("pink", "green", "orange"), scaled = TRUE)

如何在三重维恩图中打开缩放?

创建于2023年3月20日,使用 reprex v2.0.2


<details>
<summary>英文:</summary>

You have to make sure your areas are correctly summed in the arguments like this:

``` r
library(VennDiagram)
grid.newpage()                                        # Move to new plotting page
draw.triple.venn(area1 = 153,                          # Different color for each set
                 area2 = 173,
                 area3 = 224,
                 n12 = 142,
                 n23 = 166,
                 n13 = 148,
                 n123 = 140,
                 col = &quot;red&quot;,
                 fill = c(&quot;pink&quot;, &quot;green&quot;, &quot;orange&quot;), scaled = TRUE)

如何在三重维恩图中打开缩放?<!-- -->

#&gt; (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3], polygon[GRID.polygon.4], polygon[GRID.polygon.5], polygon[GRID.polygon.6], text[GRID.text.7], text[GRID.text.8], text[GRID.text.9], text[GRID.text.10], text[GRID.text.11], text[GRID.text.12], text[GRID.text.13], text[GRID.text.14], text[GRID.text.15], text[GRID.text.16])

<sup>Created on 2023-03-20 with reprex v2.0.2</sup>

答案2

得分: 2

如果您希望图表按比例缩放,使每个区域的大小大致与其包含的数量成比例,您应该使用 eulerr 包。请注意,在您的示例中,三个区域之间的重叠部分非常大,以至于几乎无法再识别为维恩图表了。以下是示例代码:

library(eulerr)

plot(euler(c(
       "a" = 3, "b" = 5, "c" = 50,
       "a&b" = 2, "a&c" = 8, "b&c" = 26,
       "a&b&c" = 140
   )), quantities = TRUE,
   fills = scales::alpha(c("pink", "green", "orange"), 0.3))

如何在三重维恩图中打开缩放?

英文:

If you want the diagram to be scaled so that all the areas are (approximately) proportional to the number each contains, you should use the eulerr package instead. Note that in your example, the overlap between the three areas is so large that it is barely recognizable as a Venn Diagram any more:

library(eulerr)

plot(euler(c(
       &quot;a&quot; = 3, &quot;b&quot; = 5, &quot;c&quot; = 50,
       &quot;a&amp;b&quot; = 2, &quot;a&amp;c&quot; = 8, &quot;b&amp;c&quot; = 26,
       &quot;a&amp;b&amp;c&quot; = 140
   )), quantities = TRUE,
   fills = scales::alpha(c(&quot;pink&quot;, &quot;green&quot;, &quot;orange&quot;), 0.3))

如何在三重维恩图中打开缩放?

huangapple
  • 本文由 发表于 2023年3月21日 02:22:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/75793971.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定