[R] Changing the text in the strips of lattice plots and y axis

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Nov 15 04:56:01 CET 2007


On Nov 14, 2007 9:06 PM, Judith Flores <juryef at yahoo.com> wrote:
> Dear R-helpers,
>
>    I am sorry for asking something I know has been
> asked before, I have tried different combinations in
> the strip function without success...
>
>
>     I am using version 2.5.1 and work on a PC.
>
>    I have  barcharts generated from the following
> formula:
>
> barchart(y1+y2+y3~x | g)
>
> I need to change the names of the variables y1,y2 or
> y3 that currently appear in the strips, I have two
> strips per panel, one corresponds to the name of the
> variable (y1 or y2) and the second strip to the value
> of the conditional variable (g has two levels, this
> means I have 6 panels total).
>
>   Instead of y1,y2 and y3 I would like the strips to
> read 'name of variable y1', 'name of variable y2',
> 'name of variable y3'; of course these are not the
> real names I want to assign to those variables.

The easiest way is to set the dimnames; e.g., something like

p <- barchart(...)
dimanames(p)[[1]] <- c("A", "B", "C")
p

>   And my second question is regarding the the limits
> of the y axis. If I setup scales to relation='free', I
> obtain 6 different scales, which is expected. But I
> need the panels that correspond to each y variable
> have the same scale. I tried something like this:
>
> prepanel=function(x,y,...) {ylim=list(min(y),max(y)) }
>
>    but didn't work...
>
> What do I need to do?

I'm not sure what you are looking for. Please provide a reproducible example.

-Deepayan

>
> Thank you very much in advance for your help,
>
> Judith
>
>
>       ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list