> I have some data which consists of time series for a number of sites. It
> appears that there is not much autocorrelation in the data and I have
> fitted a cubic for each site using lm. I would like to obtain a lattice
> plot with one panel for each site and showing the original data, and the
> fitted cubic.

This is very easy to do with ggplot:

install.packages("ggplot")
library(ggplot)

p <- ggplot(temp, . ~ LocCode, aes=list(y=Density, x=Year))
(p <- ggpoint(p))
ggsmooth(p, method=lm, formula=y~poly(x,3))

You can also do it with fitted values in another column.

temp$fitted <- fitted(paraslm1)

p <- ggplot(temp, . ~ LocCode, aes=list(y=Density, x=Year))
(p <- ggpoint(p))
ggline(p, aes=list(y=fitted))

Hadley

______________________________________________
[email protected] 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.

Reply via email to