# # Reproducible example. # library(ggplot2) set.seed(42) x <- 1:20 y1 <- 2*x+3 y2 <- rep(y1,2) + rnorm(40,0,4) y3 <- rep(y1,2) + rnorm(40,0,10) xxx <- data.frame(x=rep(x,2),y1=y1,y2=y2,grp=factor(rep(c("a","b"),each=20))) plotObj <- ggplot(xxx) + geom_line(aes(x=x,y=y1)) + ylab("y")+ geom_point(aes(x=x,y=y2),shape=20,col="blue",show.legend=TRUE) + geom_point(aes(x=x,y=y3),shape=3,col="red",show.legend=TRUE) + scale_colour_manual("Doesn't work",values=c("blue","red"), labels=c("clyde","irving")) + facet_grid(cols=vars(grp))