[R] (Lattice) How to improve the readability of a bwplot, i.e. separating groups somehow
Deepayan Sarkar
deepayan at stat.wisc.edu
Tue Aug 3 15:50:05 CEST 2004
On Tuesday 03 August 2004 06:39, 8rino-Luca Pantani wrote:
> Hi all,
> first of all thanks for the answer to my previous question on lattice
> some time ago.
> In particular to Patrick Connolly for advices on netiquette (I hope
> this time I'm doing right....)
> and to Deepayan Sarkar fro the help on lattice.
>
> Now, my nowaday problem.
>
> Please consider the following
>
> mydf<-cbind.data.frame(
> RESPONSE = c(rnorm(9,rep(2:4,each=3),10),
> rnorm(9,rep(7:9,each=3),10),
> rnorm(9,rep(5:7,each=3),10),
> rnorm(9,rep(9:11,each=3),10)
> ),
> STD = c(rep("Std.Ext",18), rep("Std.Int",18)),
> METHOD = rep(c("A","B"),2, each=9),
> VIAL = rep(paste("Vial",rep(1:3, each=3)),4))
> library(lattice)
> my.theme<-list(background=list(col=0),
> strip.background=list(col="transparent"),
> box.dot=list(cex=0.1, col=1),
> box.umbrella=list(col=1,lty=1),
> box.rectangle=list(col= 1))
> lset(my.theme)
> bwplot(paste(METHOD,VIAL)~RESPONSE|STD, data=mydf)
>
> as a (fictitious) experiment on a determination of a substance in 3
> vials, which was quantified
> with an external (or internal) standard,
> with two different methods (A or B)
> with 3 injections per vial (replicates)
>
> I would like to stress the difference between A and B (Method) in the
> bwplot,
> so I imagine I could distantiate the boxplots, or colour them
> according to the "Method".
Why not
bwplot(VIAL ~ RESPONSE | STD + METHOD, data=mydf)
?
> How can I add a blank line between "A Vial 3" and "B Vial 1"?
You could create a factor with a fake blank level. e.g.,
mydf$METHOD.VIAL <-
factor(with(mydf, paste(METHOD, VIAL)),
levels = c("A Vial 1", "A Vial 2", "A Vial 3",
" ", "B Vial 1", "B Vial 2",
"B Vial 3"))
bwplot(METHOD.VIAL ~ RESPONSE | STD, data=mydf, drop = FALSE)
> Or how can I change the colour of the boxplots? (say the three lower
> ones in black, and the rest red)
That's going to be non-trivial. If you are really desparate, look at
http://tolstoy.newcastle.edu.au/R/help/04/02/0848.html
Hope that helps,
Deepayan
More information about the R-help
mailing list