[R] how to make a median line thicker in bwplot (lattice)

David Winsemius dwinsemius at comcast.net
Mon Feb 11 16:35:06 CET 2013


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 at 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



More information about the R-help mailing list