Hi, Given a data frame, I'm trying to graph multiple lines on one graph, each line being a different color and each colored line corresponding to a specific name in the legend. Here is a very basic data sample to work with:
x <- seq(0,40,10) y1 <- sample(1:50,5) y2 <- sample(1:50,5) mydf <- data.frame(x,y1,y2) p <- ggplot(mydf,aes(x=mydf$x)) + geom_line(aes(y=mydf$y1,colour="green4")) + geom_line(aes(y=mydf$y2,colour="blue2")) + scale_color_manual(name="legend",values=c(y1="green4",y2="blue2")) p When I run this, the entire plot is blank. What I WANT to show up is two lines, one being the color of green4 and the other being blue2. Besides that, I'm trying to associate the colors with the names "y1" and "y2" in the legend, but my codes don't seem to be working. I'm very new to R/ggplot2, and I really appreciate any and all help I can get. Thank you! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.