I am trying to have two legends: one based on variable c and the other on variable d, defined by their own shape and size. I do know if this is possible in ggplot2? Maybe it is not fitting to the philosophy behind the use of ggplot2. If I transform the data to long format, I can deal with the different shapes, but the sizes are confounded. The same is happening if I use a facet_wrap option.
structure(list(a = c(5, 6, 7), b = c(5, 6, 7), c = c(0.1, 0.5,
1), d = c(10, 5, 1)), .Names = c("a", "b", "c", "d"), row.names = c(NA,
-3L), class = "data.frame")
library(ggplot2)
plot <- ggplot() + geom_point(data=e,aes(x=a,y=b,size=c), shape=1,
color="black")
plot <- plot + geom_point(data=e,aes(x=a,y=b,size=d), shape=3, color="red")
plot
Any advice is more than welcome.