i want save, not print (for now), bunch of ggplot()s grid (via arrangegrob(), correct?), print , retrieve them later.
this reboot of existing question. strangely, that answer not work, , have no idea why. using exact same code.
library(ggplot2) p1 <- ggplot(mtcars, aes(x=factor(cyl), y=mpg)) + geom_boxplot() p2 <- ggplot(mtcars, aes(x=factor(cyl), y=wt)) + geom_boxplot() library(gridextra) y <- arrangegrob(p1, p2) class(y) y strangely, not (as in above answer) yield grid of plots, but:
> class(y) [1] "gtable" "grob" "gdesc" > y tablegrob (2 x 1) "arrange": 2 grobs z cells name grob 1 1 (1-1,1-1) arrange gtable[layout] 2 2 (2-2,1-1) arrange gtable[layout] what going on here?
the gridextra package has been updated thereby changing how arrangegrob works internally , kind of object returns (now gtable).
you need call grid.draw:
grid.draw(y) 
edit: not use plot() suggested; add grey background, , meant used debugging gtables.
Comments
Post a Comment