[R] histogram colors in lattice

From: Jamie Jarabek <jamie.jarabek_at_gmail.com>
Date: Wed 27 Sep 2006 - 03:32:46 GMT


I have code that constructs a plot using the lattice package that looks something like the following toy example:

library(lattice)
Start <- factor(rbinom(100,1,.5))
Answer <- 2 - rbinom(100,1,.7)

histogram(~Answer | Start,

          breaks=c(1, 1.4 ,1.6,2),
          scales=list(x=list(at=c(1.2,1.8),labels=c("Yes","No"))),
          xlab="",ylab="")

I would like to have different colors for the bars in the left and right panel (say red and green) but I can't find a way to do this. Can anyone give me any advice on how to achieve this?

Thanks,
Jamie Jarabek

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch 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. Received on Wed Sep 27 13:35:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 27 Sep 2006 - 04:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.