I\'d like to create a faceted plot with margins in ggplot2. However, I\'d like the margin plot to have colours according to from which facet the particular point has been de
Another option would be to create the faceted plots and margin plot separately and use the gridExtra
library to combine them:
library(ggplot2)
library(gridExtra)
mtcars$ALL <- "all"
p <- ggplot(mtcars, aes(mpg, wt))
p1 <- p + geom_point() + facet_grid(.~gear)
p2 <- p + geom_point(aes(color=factor(gear))) + facet_grid(.~ALL)
grid.arrange(p1, p2, ncol=2)