Re: [R] Plot with two different coloured regression lines and legend

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Tue, 04 Mar 2008 13:04:32 -0500 (EST)


Untested but
abline(lm(sabund[[i]]~sbif[[i]]), col=i) may do it.

It would be better to have a working example to test. --- yvo <yvo.fabian_at_gmx.de> wrote:

>
> It is a trivial problem, but in the book I couln`t
> figure out how to put
> different colours at different regression lines
>
> plot(bif,abund,type="n", xlab=
> "number_bifurcations", ylab="abundances")
> sbif<-split(bif,stage)
> sabund<-split(abund,stage)
> points(sabund[[2]],sbif[[2]],pch=16, col="red")
> for(i in 1:2) abline(lm(sabund[[i]]~sbif[[i]]))
>
> Thanks in advance
> Yvonne Fabian
> --
> View this message in context:
>
http://www.nabble.com/Plot-with-two-different-coloured-regression-lines-and-legend-tp15828255p15828255.html
> Sent from the R help mailing list archive at
> Nabble.com.
>
> ______________________________________________
> 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.
>



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. Received on Tue 04 Mar 2008 - 18:07:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 18:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive