[R] merging plot labels in a lattice plot
Peter Ehlers
ehlers at ucalgary.ca
Fri Jul 2 19:32:50 CEST 2010
On 2010-07-02 9:57, Rajarshi Guha wrote:
> Hi, I have a lattice lot conditioned on two variables. Example code is:
>
> library(lattice)
> x<- data.frame(d=runif(100),
> f1=sample(c('yes', 'no'),100,replace=TRUE),
> f2=c(rep('Run1',30),rep('Run2',30),rep('Run3',40)))
> histogram(~d | f1 + f2, x)
>
> In the plot, for a given value of f2, there are two panels, one for
> 'n' and one for 'yes'. But above each panel I get the value of f2.
>
> What I'd like to be able to do is to have the value of f2 span the two
> panels (ie merge the green rows and use a single label).
>
> Any pointers as to how I could acheive this would be appreciated
>
> Thanks,
>
I like the useOuterStrips() function in the latticeExtra
package for this:
useOuterStrips(histogram(~d | f1 + f2, x))
-Peter Ehlers
More information about the R-help
mailing list