[R] lattice question: removing strips

Gerrit Draisma gdraisma at xs4all.nl
Tue Feb 11 14:30:39 CET 2014


Dear Martin,
Would
-------------
library(latticeExtra)
useOuterStrips(p)
-------------
be useful for you?
Gerrit.

> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 10 Feb 2014 14:12:45 +0200 (EET)
> From: Martin Ivanov <tramni at abv.bg>
> To: Pascal Oettli <kridox at ymail.com>
> Cc: r-help at r-project.org
> Subject: Re: [R] lattice question: removing strips
> Message-ID:
> 	<999135689.229399.1392034366300.JavaMail.apache at mail21.abv.bg>
> Content-Type: text/plain; charset="UTF-8"
>
>
> Dear Pascal,
> Thank You very much for Your reply. Here is a minimal working example:
>
> library(lattice);
> # this is with both strips plotted:
> data <- data.frame(x=1:5, y=6:10, f1=c("a1", "a1", "a1", "a2", "a3"), f2=c("b1", "b2", "b2", "b1", "b2"));
> p <- xyplot(y ~ x | f1 + f2, data=data)
> print(p);
>
> # and this is my attempt to only plot the strips for the second conditioning variable, i.e. for f2:
> my.strip <- function(which.given, strip.levels, ...) {
>   if(which.given == 1) {
>     return(FALSE);
>   }
>   else {
>     strip.default(which.given=which.given, strip.levels=c(TRUE, FALSE), ...);
>   }
> }
>
> p1 <- xyplot(y ~ x | f1 + f2, data=data, strip=my.strip)
> print(p1);
>
> #As You can see, here I do not get the strips for f1 potted, but there is an empty space below
> the strips for f1, which I cannot get rid of. I only want to show the strips for f2. Directly
> below them I want to see the panels themselves, instead of an empty space for the missing f1 strips.
>
> Any suggestions?
>
> Best regards,
>
> Martin




More information about the R-help mailing list