Skip to content
Prev 168957 / 398506 Next

xyplot with lowess curves

You'll need a custom panel function. It would also help if you
provided a reproducible example:

xyplot (
  SnowLineElevation ~ Year | Model,
  data = data,
  panel = function(x, y, col, ...) {
    col <- ifelse(panel.number() == 1, "red", "green")
    panel.xyplot(x, y, col = "blue", ...)
    panel.loess(x, y, col = col)
  },
  ylim = c(0,1800),
  pch = 21,
  xlab = 'Year',
  ylab = 'Snowline Elevation [m]'
)

Alternatively, you can use the group argument in conjunction with the panels:

xyplot(SnowLineElevation ~ Year | Model, data, groups = Model, type =
c("p", "smooth"))

if you want the points and the lines to be the same color.

--sundar

On Mon, Feb 2, 2009 at 10:20 AM, Hutchinson,David [PYR]
<David.Hutchinson at ec.gc.ca> wrote: