Hi All, I need a small help plotting median lines on lattice boxplots.
# Data a <- rep(c("A","B"), each=10) b <- rep(c("a","a+b","b","b+a"), each=5) c <- c(1,9,5,2,7,7,8,8,8,5,4,5,3,2,5,6,7,8,9,1) x <- data.frame(a, b, c) med.A <- median(subset(x$c, x$a=="A")) med.B <- median(subset(x$c, x$a=="B")) median(group A) = 7 median(group B) = 5 I need help to plot two (horizontal) lines, one for each subgroup. - Line 1 coordinates should be (0, 7) to (2.5, 7) - Line 2 coordinates should be (2.5, 5) to (5, 5) I'm unable to control the length of these lines, can anyone please help me with this, I would highly appreciate any help. (I tried using panel.curve, but of no use) # Plotting code: library(lattice) bwplot(c ~ b, data = x, panel = function(...) { panel.abline(v=2.5, col.line="gray") panel.bwplot(...) } ) Thank in advance, -- Xin Ge. [[alternative HTML version deleted]] ______________________________________________ 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.