From: Klaus Nordhausen <klausch_at_gmx.de>

Date: Mon, 21 May 2007 14:39:49 +0200

Date: Mon, 21 May 2007 14:39:49 +0200

library(lattice)

bwplot(Value ~ Alg | GOF, data = test.data, as.table=T, layout=c(1,3))

bwplot(Value ~ Alg | GOF, data = test.data, scale=list(relation="free"), as.table=T, layout=c(1,3))

from which my first question arises:

Then I would like to modify the boxplot - actually I'm not interested so much in the boxes of factor R1 (=random guess) but would rather have a horizontal line in each panel at the median of R1 for the given panel, and only the boxes for levels A1, A2 and A3 - and the horizontal line I would like only if it would fall in the plotting area when only plotting the boxes for the levels A1, A2 and A3 (this means in the third panel the line should not be there).

My attempt

test.data$ind <- ifelse(Alg=="R1",1,0)

my.boxpanel <- function(x, y, subscripts, groups, ...) {

orig <- groups[subscripts] == 0 panel.bwplot(x[orig], y[orig], ...) panel.abline(h=median(y[!orig])) } bwplot(Value ~ Alg | GOF, data = test.data, scale=list(relation="free"), as.table=T, groups=ind, layout=c(1,3),panel=my.boxpanel, drop.unused.levels=T, xlim=c("A1","A2","A3"), ylim=list(c(0,1),c(-2,2),c(0,17)))

requires that I know the range of the yaxis and at the xaxis leaves space for the box of R1. Can that be avoided?

Then my last question - I would like to emphasise the best factor=algorithm in each panel by coloring its box. However "best" means in the first two panels lowest median and in the last panel highest median. Can this be done? I managed it only when in all panels the lowest median box should be filled with color.

trellis.device(color = FALSE)

my.boxpanel2 <- function(x, y, subscripts, groups, ...) {

orig <- groups[subscripts] == 0 medians<-tapply(y[orig],x[orig],median) medians2<-medians[!is.na(medians)] cols<-grey((1-as.numeric(medians2==min(medians2))/3)) z<-x[orig] levels(z)<-c("A1","A2","A3",NA) w<-y[orig] panel.bwplot(z, w, fill=cols, ...) panel.abline(h=median(y[!orig])) } bwplot(Value ~ Alg | GOF, data = test.data, scale=list(relation="free"), as.table=T, groups=ind, layout=c(1,3),panel=my.boxpanel2, drop.unused.levels=T, xlim=c("A1","A2","A3"), ylim=list(c(0,1),c(-2,2),c(0,17)))

It would be great if you could help me with this plot!

Thanks in advance,

Klaus

-- ______________________________________________ R-help_at_stat.math.ethz.ch 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.Received on Mon 21 May 2007 - 12:44:54 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 21 May 2007 - 14:30:54 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*