Re: [R] multiple lowess line in one plot

From: Gregory Snow <Greg.Snow_at_intermountainmail.org>
Date: Thu 05 Jan 2006 - 07:04:23 EST


Here is one approach using lattice (trellis) graphics:

tmp.state <- data.frame( Frost=state.x77[,'Frost'],

	Murder=state.x77[,'Murder'], 
	Region=state.region)

library(lattice)
trellis.par.set(col.whitebg())
xyplot( Murder ~ Frost, groups=Region, data=tmp.state,

        panel.groups=function(...){panel.loess(...);panel.xyplot(...)} ,span=.8)

Just substitute in your variables and variable names.

Hope this helps,

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


> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Dean Sonneborn
> Sent: Wednesday, January 04, 2006 9:54 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] multiple lowess line in one plot
>
> I'm using this code to plot a smoothed line. These two
> columns of data really represent 4 groups and I'd like to
> plot a separate line for each group but have them all in the
> same plot. The R-Docs for lowess do not seem to indicate some
> type of "GROUPS=var_name" option. What would be the syntax for this?
>
> plot(AWGT ~ lipid )
> lines(lowess(lipid , AWGT, f=.8))
>
>
> --
> Dean Sonneborn, MS
> Programmer Analyst
> Department of Public Health Sciences
> University of California, Davis
> (530) 754-9516
>
> ______________________________________________
> R-help@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
> ______________________________________________ R-help@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
Received on Thu Jan 05 08:24:53 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:50 EST