I want a combined plot of two plots + their legend like this:
library(ggplot2) library(grid) library(gridExtra) dsamp <- diamonds[sample(nrow(diamonds),
Why don't you use facetting?
library(reshape2) dmelt <- melt(dsamp, id.vars = c("price", "clarity"), measure.vars = c("carat", "depth")) ggplot(dmelt, aes(x = price, y = value, color = clarity)) + geom_point() + facet_wrap(~ variable, scales = "free")