[R] Trend lines on a scatterplot matrix

Greg Snow Greg.Snow at intermountainmail.org
Mon Jul 23 17:24:15 CEST 2007


Start with something like this:

pairs(iris, panel= function(x,y,...){
	points(x,y);
	abline(lm(y~x))})

Then substitute in your data and extra args and any other enhancements
you want.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Alan S Barnett
> Sent: Thursday, July 19, 2007 3:51 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Trend lines on a scatterplot matrix
> 
> I'm using pairs() to generate a scatterplot matrix;
> 
> pairs(~ 
> Fuzzy.gray.white.ratio+Fuzzy.gw.t.score+AgeWhenTested+signal_m
> ean.noise,
> 	data=datam,subset=status=="control",main="Controls",
>         labels=c("G/W","Peak Separation","Age","S/N"))
> 
> 
> How can I add regression lines to the plots?
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list