I am trying to plot a line graph for 3 or more regression lines abline(m1) abline(m2) abline(m3) Can I change the color of each line? if so how? Thanks in advance Ashta [[alternative HTML version deleted]]
Try this: abline(m1, col = 'blue') abline(m1, col = 'red') abline(m1, col = 'green') On Thu, Oct 1, 2009 at 10:57 AM, Ashta <sewashm at gmail.com> wrote:> I am trying to plot a line graph for 3 or more regression lines > > abline(m1) > abline(m2) > abline(m3) > > Can I change the color of each line? if so how? > > Thanks in advance > Ashta > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
abline(m1, col="red") regards, Stefan On Thu, Oct 01, 2009 at 09:57:11AM -0400, Ashta wrote:> I am trying to plot a line graph for 3 or more regression lines > > abline(m1) > abline(m2) > abline(m3) > > Can I change the color of each line? if so how? > > Thanks in advance > Ashta > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >
On Thu, Oct 1, 2009 at 6:57 AM, Ashta <sewashm@gmail.com> wrote:> I am trying to plot a line graph for 3 or more regression lines > > abline(m1) > abline(m2) > abline(m3) > > Can I change the color of each line? if so how? > > Thanks in advance > Ashta >Try passing the 'col' parameter to abline: abline( m1, col = 'red' ) ablime( m1, col = 'blue' ) abline( m1, col = 'purple' ) See ?par for other plot parameters like col that can be set this way. ?rgb gives an example of setting color by RGB value. Other specifications such as HSV are possible. The colors() function will show a list of all built colors that may be specified using a string such as 'red' . ?rainbow will show information concerning built in functions for generating color palettes. The RColorBrewer package also contains some great palettes. Also, a help search such as: ??'colors' Will turn up all kinds of other functions that may deal with setting or creating colors. Hope this helps! -Charlie [[alternative HTML version deleted]]
Hi Ashta, See the "..." in ?abline. HTH, Jorge On Thu, Oct 1, 2009 at 9:57 AM, Ashta <> wrote:> I am trying to plot a line graph for 3 or more regression lines > > abline(m1) > abline(m2) > abline(m3) > > Can I change the color of each line? if so how? > > Thanks in advance > Ashta > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]