Dear Deepayan, Haris, and Baptiste,

Thank you !!!

Ferry

On Tue, Oct 14, 2008 at 10:06 AM, Deepayan Sarkar <[EMAIL PROTECTED]
> wrote:

> On 10/13/08, Ferry <[EMAIL PROTECTED]> wrote:
> > Dear R users,
> >
> >  How to change lattice panel label/text from the automatically generated
> >  label (based on the conditioning) to our own set of label?
> >
> >  for example:
> >
> >  someStuff <- data.frame(area = rep(c("SOUTH", "NORTH", "EAST", "WEST"),
> each
> >  = 25),
> >                 group = rep(c("A","B","C","D"), each = 5),
> >                 mytime = rep(1:4),
> >                 val1 = sample(1:100, size=100, replace=TRUE),
> >                 val2 = sample(1:100, size=100, replace=TRUE)
> >         )
> >
> >  xyplot(val1+val2 ~ mytime | area * group, data = someStuff, type =
> c("a",
> >  "p", "g"))
> >
> >  I want to change each panel label/text from for example D/East or
> D/North
> >  ... into Deriv/From East, Deriv/From North ...
> >
> >  I know I could change from the data, but is there a way to change it
> from
> >  lattice ?
>
> Using a strip function is the most general way, but can get a bit
> complicated with two variables. Changing the labels is really the
> easiest way; e.g.,
>
> xyplot(val1+val2 ~ mytime | factor(area, labels = c("From East", ...))
> * factor(group, ...))
>
> You could also change the 'dimnames' of the resulting object before
> plotting:
>
> > p <- xyplot(val1+val2 ~ mytime | area * group, data = someStuff)
> > dimnames(p)
> $area
> [1] "EAST"  "NORTH" "SOUTH" "WEST"
>
> $group
> [1] "A" "B" "C" "D"
>
> > dimnames(p)$area <- ...
> > plot(p)
>
> -Deepayan
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to