ggplot2 - can we arrange grid.draw output into a single plot in R -
is there method can arrange multiple grid.draw output single plot.
i have multiple grid.draw outputs shown below.
g <- ggplotgrob(p1) g <- gtable_add_grob(g, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g) g1 <- ggplotgrob(p2) g1 <- gtable_add_grob(g1, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g1) g2 <- ggplotgrob(p2) g2 <- gtable_add_grob(g2, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g2) g3 <- ggplotgrob(p3) g3 <- gtable_add_grob(g3, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g3) i tried grid.arrange got error saying object g1 not found.
i used below code.
grid.arrange(grid.draw(g1),grid.draw(g2),grid.draw(g3),ncol=2)
Comments
Post a Comment