I am trying to combine two ggplot FACETED objects using coord_equal()with cowplot::plot_grid()or egg::ggarrange()and and vertically align them.
The approach is egg::ggarrange()great for UNFACETED charts, and the solution is published here .
However, the solution egg::ggarrange()breaks when the cut is turned on. The graphs are correctly aligned, but the units of the y-axis are two times larger than the x-axis . Any suggestions on how to generalize this for a cut?
dat1 <- data.frame(x = rep(1:10, 2), y = 1:20, z = rep(c("A", "B"), 10))
dat2 <- data.frame(x = 1:10, y = 1:10, z = rep(c("A", "B"), 5))
plot1 <- ggplot(dat1, aes(x=x, y=y)) +
geom_point() + coord_equal() + facet_wrap(~z)
plot2 <- ggplot(dat2, aes(x=x, y=y)) +
geom_point() + coord_equal() + facet_wrap(~z)
egg::ggarrange(plot1, plot2, ncol = 1)

Kevin source
share