[R] lattice question: how to change the dot on boxplot to line

Ranjan Maitra maitra.mbox.ignored at inbox.com
Tue Dec 11 04:03:10 CET 2012


Hi,

How does one change the dot for the median in a boxplot drawn using
lattice? I have been looking at

> names(trellis.par.get())
 [1] "grid.pars"         "fontsize"          "background"       
 [4] "panel.background"  "clip"              "add.line"         
 [7] "add.text"          "plot.polygon"      "box.dot"          
[10] "box.rectangle"     "box.umbrella"      "dot.line"         
[13] "dot.symbol"        "plot.line"         "plot.symbol"      
[16] "reference.line"    "strip.background"  "strip.shingle"    
[19] "strip.border"      "superpose.line"    "superpose.symbol" 
[22] "superpose.polygon" "regions"           "shade.colors"     
[25] "axis.line"         "axis.text"         "axis.components"  
[28] "layout.heights"    "layout.widths"     "box.3d"           
[31] "par.xlab.text"     "par.ylab.text"     "par.zlab.text"    
[34] "par.main.text"     "par.sub.text"     

I tried playing around with dot.line and dot.symbol but could not
figure out what to do. Is there anything else I could try.



As a reproducible example, we can consider:

library(lattice)
bwplot(voice.part ~ height, data=singer, xlab="Height (inches)")

I want the dots for the medians to be replaced by a line through the
median.

Any suggestions?

Many thanks,
Ranjan

PS; Also, how do I get the rectangles to be filled? I tried the
following:

box.rectangle <- trellis.par.get("box.rectangle")
box.rectangle$fill<-"opaque"

(also tried "filled", "shaded", etc. to no avail)

trellis.par.set("box.rectangle",  box.rectangle)

but get errors in plotting.

Many thanks again and best wishes,
Ranjan

____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!



More information about the R-help mailing list