Try this: library(lattice) set.seed(1) ## added for reproducibility 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"))), panel = function(x, ..., panel.number, col) { ## added this panel function panel.histogram(x, ..., col = panel.number+1) }, xlab="",ylab="") On 9/26/06, Jamie Jarabek <[EMAIL PROTECTED]> wrote: > 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. > ______________________________________________ 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.