[R] Assigning line colors in xyplot
hadley wickham
h.wickham at gmail.com
Fri Aug 31 14:49:15 CEST 2007
On 8/31/07, Christof Bigler <christof.bigler at env.ethz.ch> wrote:
> The suggestions by Deepayan Sarkar and Hadley Wickham work for that
> case, but I get into troubles when I try to draw e.g. a panel for "A"
> and "B":
>
> xyplot(y ~ x | f , groups=g, data=tmp,type="l",
> par.settings=list(superpose.line=list(col=c("red","blue"))),
> auto.key=list(space="top",
> text=levels(tmp$f),points=FALSE,lines=TRUE))
In ggplot, you would need to specify the grouping variable as well as
the colour variable:
qplot(x, y, data=tmp, geom="line", colour=f, group=interaction(f,g))
which should work for any facetting.
Hadley
More information about the R-help
mailing list