Kaptue Tchuente, Armel
2013-Jun-04 21:05 UTC
[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. Thanks Armel -------------- next part -------------- A non-text attachment was scrubbed... Name: multiple_lines_graph.png Type: image/png Size: 15005 bytes Desc: multiple_lines_graph.png URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130604/3ebaad2c/attachment.png>
Rui Barradas
2013-Jun-05 10:01 UTC
[R] How to display multiples lines with different color on the same plot?
Hello, See the help pages for ?abline ?par # parameter 'col' Hope this helps, Rui Barradas Em 04-06-2013 22:05, Kaptue Tchuente, Armel escreveu:> 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. > > Thanks > > Armel > > > > ______________________________________________ > R-help at r-project.org mailing list > 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. >
David Winsemius
2013-Jun-05 11:53 UTC
[R] How to display multiples lines with different color on the same plot?
On Jun 4, 2013, at 3:05 PM, Kaptue Tchuente, Armel wrote:> 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).If you want lines that only span a portion of a plot area, then you should be looking at the segments function. -- David Winsemius, MD Alameda, CA, USA
John Kane
2013-Jun-05 19:28 UTC
[R] 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> -----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. > > Thanks > > Armel > > ______________________________________________ > R-help at r-project.org mailing list > 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.____________________________________________________________ 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