使用VennDiagram
包我按以下方式生成两个图:
# First graph
VennDiagram::draw.pairwise.venn(
area1 = 100,
area2 = 70,
cross.area = 30,
category = c("A1", "B1"),
fill = c("#00204DFF", "#FFEA46FF")
) -> vg1
# Second graph
VennDiagram::draw.pairwise.venn(
area1 = 120,
area2 = 80,
cross.area = 10,
category = c("A2", "B2"),
fill = c("#000004FF", "#FCFFA4FF")
) -> vg2
通过grid::grid.draw(vg1)
和grid::grid.draw(vg2)
进行调用时,图表会按预期显示:
如何创建一个网格对象,其中两个图都放在另一个下?
grdFrme <- grid::grid.frame(name = "gf")
grid::grid.pack("gf", vg1)
packGrob中的错误(grid.get(gPath),grob,side,row,row.before, row.after,:无效'grob'
答案 0 :(得分:4)
一个解决方案可能是使用真棒multipanelfigure
包(用基础填充面板,&#39;格&#39;,&#39; ggplot2&#39;&#39; ComplexHeatmap&# 39;绘图,凹凸和PNG,JPEG,SVG和TIFF图像)。
library(multipanelfigure)
figure <- multi_panel_figure(columns = 1, rows = 2)
figure %<>%
fill_panel(vg1) %<>%
fill_panel(vg2)