Skip to content
Back to formatted view

Raw Message

Message-ID: <569610.92905.qm@web32801.mail.mud.yahoo.com>
Date: 2008-03-04T18:04:32Z
From: John Kane
Subject: Plot with two different coloured regression lines and legend
In-Reply-To: <15828255.post@talk.nabble.com>

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.
>