[R] lattice xyplot strip colors and location
Duncan Mackay
mackay at northnet.com.au
Thu Aug 20 12:10:43 CEST 2009
Hi Shankar
On a slightly different note - below produces a strip to the left without
the stacked strips
require(latticeExtra) # NB install if not found
useOuterStrips(strip=strip.custom(bg="skyblue"),
strip.left=strip.custom(bg="yellow"),
xyplot(V4~V3|frac.f*stdev.f,
aspect=3/4,
xlab="Min number of reads",
ylab="Number of misjoins"
)
)
HTH
Duncan Mackay
Department of Agronomy and Soil Science
Univeristy of New England
ARMIDALE NSW 2351
Email: home : mackay at northnet.com.au
At 12:23 20/08/2009, you wrote:
>Hi all,
>
>I've been trying (unsuccessfully) to modify an xyplot I created using the
>lattice package. I would like to change default strip colors and locations.
>I started with numeric data in 4 columns, which look like this:
>
>0.25 2 1 32
>0.25 2 2 30
>0.25 2 3 27
>0.25 2 4 23
>0.25 2 5 17
>0.25 3 1 30
>0.25 3 2 29
>0.25 3 3 26
>0.25 3 4 21
>0.25 3 5 15
>0.5 2 1 23
>0.5 2 2 23
>0.5 2 3 22
>0.5 2 4 18
>0.5 2 5 15
>0.5 3 1 22
>0.5 3 2 22
>0.5 3 3 21
>0.5 3 4 16
>0.5 3 5 13
>
>Here's what I've done so far:
>
>library(lattice)
>plotdata <- read.table(file="data.txt", header=FALSE)
>
>attach(plotdata)
>
>frac.f <- factor(V1)
>stdev.f <- factor(V2)
>levels(frac.f) <- paste("f=",levels(frac.f), sep="")
>levels(stdev.f) <- paste("s=", levels(stdev.f), sep="")
>xyplot(V4~V3|frac.f*stdev.f, aspect=3/4, xlab="Reads as evidence",
>ylab="Total incorrect")
>detach(plotdata)
>
>Conditional variable values now appear as two stacked strips at the top of
>each panel. I'd like to move one to the left and also change strip colors.
>
>I tried the following but it didn't produce the desired result
>
>xyplot(V4~V3|frac.f*stdev.f, aspect=3/4, xlab="Min number of reads",
>ylab="Number of misjoins", strip=strip.custom(which.given=1,
>bg="skyblue"), strip.left=strip.custom(which.given=2,bg="yellow"))
>
>This changes the colors but also does the following
>- positions the left strips slightly away from the respective panels
>- all strip labels and values reflect only one conditional variable (s=2,
>s=3, etc.)
>
>Any help would be much appreciated
>
>Thanks,
>Shankar
>
>Postdoctoral Fellow
>National Human Genome Research Institute
>NIH
>Bethesda, MD
>______________________________________________
>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