Side-by-side Venn diagram using Vennerable

后端 未结 3 1556
时光说笑
时光说笑 2021-01-06 08:11

I am trying to put two Venn diagrams in one single graph, i.e. I am using par(mfrow=c(1,2)) at the very beginning. However, when I use the Venn() function in th

3条回答
  •  时光说笑
    2021-01-06 08:50

    I couldn't install that package, but a trick that might help here is to use grid.grab to capture the drawing into a grob that can be placed elsewhere,

    library(grid)
    
    myplot <- function(){
    
      pushViewport(viewport(x=0.5,width=1, just=0.5))
      grid.rect(gp=gpar(fill=grey(runif(1, 0.2, 0.8))))
      grid.points()
      popViewport()
    
    }
    
    p1 <- grid.grabExpr(myplot())
    p2 <- grid.grabExpr(myplot())
    
    library(gridExtra)
    
    grid.arrange(p1, p2, ncol=2) 
    

提交回复
热议问题