Skip to content
Prev 324798 / 398525 Next

How to display multiples lines with different color on the same plot?

Try:
library(ggplot2)
ggplot(mtcars, aes(mpg, qsec, colour = as.factor(gear))) +
  geom_point() + geom_smooth(method = lm, se = FALSE)

You probably will have to melt your data to get into the right format. 

John Kane
Kingston ON Canada
____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails