[R] controlling colour in Trellis histogram

Chuck Cleland ccleland at optonline.net
Fri Oct 1 16:25:38 CEST 2004


   Does this help?

mydata <- data.frame(OPTIMISM = 
c(29,35,26,22,30,37,29,32,25,35,38,33,41,28,40),
                      PARENTS = rep(c("Both Deceased", "One Deceased", 
"Both Alive"), c(4,5,6)))

library(lattice)

trellis.device(width=7, height=5, new = FALSE, col = FALSE, bg = "white")

histogram(~ OPTIMISM | PARENTS, data=mydata)

Bill Shipley wrote:
> Hello.  I am sorry for posting a (seemingly) simple question, but I have
> just spent 2 hours trying to find the answer, without success.  I want
> to make a histogram with conditioning on a factor, using Trellis
> graphics.  However, I do not want any colours (only black and white)
> either in the histograms or in the strip.  There must be some simple
> argument but I canÂ’t find it.  Here is my code so far:
> 
>>histogram(~GRC.SLA|as.factor(species.type),data=group.means,
> 
> + strip=function(...)
> 
> +
> strip.default(...,style=1,factor.levels=c("Conifers","Trees","Herbs","Mo
> nocots")))
> 
> As a default, this produces the bars in a pale blue and the strip in
> orange-yellow.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list