I\'m using ggplot and have two graphs that I want to display on top of each other. I used grid.arrange
from gridExtra to stack them. The problem is I want the
The egg
package wraps ggplot objects into a standardised 3x3
gtable, enabling the alignment of plot panels between arbitrary ggplots, including facetted ones.
library(egg) # devtools::install_github('baptiste/egg')
library(ggplot2)
p1 <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) +
geom_point()
p2 <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) +
geom_point() + facet_wrap( ~ cyl, ncol=2, scales = "free") +
guides(colour="none") +
theme()
ggarrange(p1, p2)