Hi Concha
You nearly got there try:
set.seed(42)
D1 <- rnorm(200)
D2 <- factor(sample(letters[1:2],200,TRUE))
D3 <- factor(sample(letters[3:5],200,TRUE))
DF <- data.frame(x=D1,a=D2,b=D3)
print(bwplot(b~x|a,data=DF,
par.settings = list(box.dot = list(rep("black",3)),
superpose.line = list(col =
c("darkorange1","limegreen","magenta")),
box.umbrella = list(col =
c("darkorange1","limegreen","magenta")),
box.rectangle =
list(fill=c("darkorange1","limegreen","magenta"),
col =
c("darkorange1","limegreen","magenta"))),
panel=function(x,...,col) {
panel.bwplot(x,...,col=col[packet.number()])
}
)
)
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au
At 06:45 8/04/2013, you wrote:
Dear all,
I would like to have the same color for the all boxplots from the
same panel, but my code below shows the two colors alternating. Thanks!
set.seed(42)
D1 <- rnorm(200)
D2 <- factor(sample(letters[1:2],200,TRUE))
D3 <- factor(sample(letters[3:5],200,TRUE))
DF <- data.frame(x=D1,a=D2,b=D3)
print(bwplot(b~x|a,data=DF,col=c("black","black"),
par.settings = list(box.rectangle =
list(fill=c("darkorange1","limegreen"))),
panel=function(x,...,col) {
panel.bwplot(x,...,col=col[packet.number()])
}
)
)
Thanks,
Concha
______________________________________________
R-help@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.
______________________________________________
R-help@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.