i have 3 ggplots (g1,g2,g3) and would like to shows them arranged so that g1 is larger and inbetween the other 2.
g1 =ggplot(data = data.frame(x = 1 ,y =1), aes(x = x, y = 1))+geom_point()
g2 = ggplot(data = data.frame(x = 1 ,y =1), aes(x = x, y = 1))+geom_point()
g3 = ggplot(data = data.frame(x = 1 ,y =1), aes(x = x, y = 1))+geom_point()
library(grid)
lay <- rbind(c(2,1,1,1,3),
c(2,1,1,1,3))
gs = grobTree( ggplotGrob(g1), ggplotGrob(g2), ggplotGrob(g3) )
grid.arrange(grobs = gs, layout_matrix = lay)
I was looking here: https://cran.r-project.org/web/packages/gridExtra/vignettes/arrangeGrob.html but I get an error. Any idea about the proper syntax?
Error in gtable_add_grob(gt, grobs, t = positions$t, b = positions$b, :
Not all inputs have either length 1 or same length same as 'grobs'