From Mehrdad.Shamsi at oicr.on.ca  Mon Oct 11 19:41:13 2010
From: Mehrdad.Shamsi at oicr.on.ca (Mehrdad Shamsi)
Date: Mon, 11 Oct 2010 13:41:13 -0400
Subject: [Rd] Lattice::bwplot unexpected behaviour when using vector of
	colors
Message-ID: <A5A59D1F01D07D4B858C05F6A96077033D0366CE4D@EXCHANGE01.ad.oicr.on.ca>

Hi,
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')
bwplot(y~x, 
	data=d, 
	horizontal=FALSE, 
	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.

--Thanks

-- M.S.



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