如何将多个维恩图合二为一 slide/plot

How to put many vennplots in one slide/plot

我有五个文氏图,我想将它们放在一张幻灯片中。我想知道任何人都可以帮助我如何去做。我使用了以下代码但无法帮助我。

gridExtra::grid.arrange(grobs = list(VD1, VD2, VD3, VD4, VD5),
                        ncol = 3, nrow = 2, labels = LETTERS[1:5])

这些是错误

Error in gList(list(1, wrapvp = list(x = 0.5, y = 0.5, width = 1, height = 1,  : 
only 'grobs' allowed in "gList"
In addition: Warning messages:
 1: In grob$wrapvp <- vp : Coercing LHS to a list
 2: In grob$wrapvp <- vp : Coercing LHS to a list
 3: In grob$wrapvp <- vp : Coercing LHS to a list
 4: In grob$wrapvp <- vp : Coercing LHS to a list
 5: In grob$wrapvp <- vp : Coercing LHS to a list

谢谢!

您可以像这样将 grid.arrangegTree 结合使用:

library(VennDiagram)
#> Loading required package: grid
#> Loading required package: futile.logger
library(gridExtra)
set.seed(1)
list1 <- list(A=sample(LETTERS, 12), B=sample(LETTERS, 12))
venn1 <- venn.diagram(list1, filename = NULL)
set.seed(2)
list2 <- list(A=sample(LETTERS, 16), B=sample(LETTERS, 12))
venn2 <- venn.diagram(list2, filename = NULL)

venn3 <- venn.diagram(list(C=sample(LETTERS, 16), D=sample(LETTERS, 12)), filename = NULL)
venn4 <- venn.diagram(list(E=sample(LETTERS, 20), F=sample(LETTERS, 22)), filename = NULL)
venn5 <- venn.diagram(list(G=sample(LETTERS, 13), H=sample(LETTERS, 14)), filename = NULL)
grid.arrange(gTree(children=venn1),
             gTree(children=venn2),
             gTree(children=venn3),
             gTree(children=venn4),
             gTree(children=venn5),
             ncol=3)

reprex package (v0.3.0)(https://reprex.tidyverse.org) (v0.3.0)

于 2020-07-21 创建