[Rd] Lattice::bwplot unexpected behaviour when using vector of colors

Mehrdad Shamsi Mehrdad.Shamsi at oicr.on.ca
Mon Oct 11 19:41:13 CEST 2010

I'm trying to produce colored boxplots using lattice::bwplot function. I need to plot each boxplot in the panel with a specific color. Naturally I used a vector of colors and expected to see colored boxplots. Although the boxplots were colored, the color of whiskers and the boxes  do not match. Here is an example:

d = data.frame(y = rnorm(100), x=1:4)
box.color <- c('red','blue','black', 'green')
	par.settings = list(
	box.rectangle = list(col = box.color),
	box.umbrella = list(col = box.color)

I went through the bwplot.panel to figure out what the problem was. It seems that bwplot.panel function is implemented with the assumption that box.rectangle$col and box.umberella$col are not vectors. It would be nice if bwplot.panel could accept vector of colors.

I use R2.11-x64 on a Windows XP machine. The lattice package version is lattice_0.19-13.


-- M.S.

More information about the R-devel mailing list