[R] How to display multiples lines with different color on the same plot?
jrkrideau at inbox.com
Wed Jun 5 21:28:49 CEST 2013
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.
Kingston ON Canada
> -----Original Message-----
> From: armel.kaptue at sdstate.edu
> Sent: Tue, 4 Jun 2013 21:05:45 +0000
> To: r-help at r-project.org
> Subject: [R] How to display multiples lines with different color on the
> same plot?
> Hi all,
> I'm struggling with the display of several regression lines (with
> different colors) on the same plot.
> I manually drew what I'm trying to do with 8 lines (see attached).
> Any thoughts for a code will be very much appreciated.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
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
More information about the R-help