Hi
I had a similar problem - see
http://tolstoy.newcastle.edu.au/R/e9/help/10/03/7129.html
DF <-
data.frame(site = factor(rep(1:5, each = 20)),
height = rnorm(100))
bwplot(height~ site,DF,
pch = "|",
panel = function(x, y, ..., horizontal) {
panel.bwplot(x, y, ..., horizontal = horizontal)
if (horizontal) {
meds <- tapply(x, y, median)
ylocs <- seq_along(meds)
panel.segments(meds, ylocs - 1/4,
meds, ylocs + 1/4,
lwd = 2, col = "red")
} else {
meds <- tapply(y, x, median)
xlocs <- seq_along(meds)
panel.segments(xlocs - 1/4, meds,
xlocs + 1/4, meds,
lwd = 2, col = "red")
} ## if (horizontal)
} ## panel function
) ## bwplot
Regards
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au
At 01:35 12/02/2013, you wrote:
On Feb 11, 2013, at 1:23 AM, Elaine Kuo wrote:
Hello,
I am drawing a boxplot using bwplot in lattice.
I would like to learn how to draw a thicker median line instead of the
default setting.
Thank you.
Code
bwplot(........,
pch=rep("|",2))
At the moment panel.bwplot has code at the end that I think deals with
that aspect:
if (all(pch == "|")) {
mult <- if (notch)
1 - notch.frac
else 1
panel.segments(levels.fos - mult * blist.height/2,
blist.stats[, 3], levels.fos + mult * blist.height/2,
blist.stats[, 3], lwd = box.rectangle$lwd, lty =
box.rectangle$lty,
col = box.rectangle$col, alpha = alpha, identifier =
paste(identifier,
"dot", sep = "."))
}
else {
panel.points(x = levels.fos, y = blist.stats[, 3],
pch = pch, col = col, alpha = alpha, cex = cex,
fontfamily = fontfamily, fontface =
chooseFace(fontface,
font), fontsize = fontsize.points, identifier =
paste(identifier,
"dot", sep = "."))
}
So you need to find a way to change the box.rectangle$lwd setting
before this code is executed. Looking at
names(trellis.par.get())
It appears that graphic parameter can be set with trellis.par.set().
--
David.
Elaine
[[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.
David Winsemius, MD
Alameda, CA, USA
______________________________________________
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.