Re: [R] ggplot2 - Specifying Colors Manually

2015-07-22 Thread Hadley Wickham
Try this: ggplot(mydf,aes(x)) + geom_line(aes(y = y1, colour = "y1")) + geom_line(aes(y = y2, colour = "y2")) + scale_color_manual(values = c(y1 = "green4", y2 = "blue2")) Note that you don't need to use `mydf` and names in the manual scale should match the values in the aes() calls. Alsoi

[R] ggplot2 - Specifying Colors Manually

2015-07-22 Thread Abiram Srivatsa
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 <-