[R] groups in lattice
Renaud Lancelot
renaud.lancelot at gmail.com
Fri Nov 2 17:02:55 CET 2007
See the argument panel.groups in panel.superpose.
library(lattice)
dfr <- data.frame(y = c(rnorm(10, 5, 1), rnorm(10, -5, 1)),
x = rep(runif(10), 2),
g = rep(c("a", "b"), each = 10))
xyplot(y ~ x, groups = g, data = dfr,
panel = function(...){
panel.superpose(..., panel.groups = "panel.xyplot")
panel.superpose(..., panel.groups = "panel.lmline")
})
Renaud
2007/11/2, Ruud H. Koning <r.h.koning at rug.nl>:
> Hello, I must be missing something very obvious. I have a dataset with
> consists of three groups, and for each group I would like to draw a
> regression line in one frame. Something like
>
> plot.a <- xyplot(result~price,data=nl,
> xlab="Standardized price",ylab="Outcome",groups=slice,
> panel=function(x,y,...){
> panel.lmline(x,y,...)
> }
> )
>
> However, only one line is drawn. If I replace panel.lmline by
> panel.densityplot(x,...), I do get three densityplots in the frame. What
> am I missing?
> Thanks, Ruud
>
> ______________________________________________
> 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.
>
--
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department
Campus International de Baillarguet
TA 30 / B
F34398 Montpellier
Tel +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 37 37
Fax +33 (0)4 67 59 37 95
More information about the R-help
mailing list