library(lattice) barchart.gray <- function(data.long, v.spc, relative = FALSE) { n.spc <- length(unique(data.long$spc)) v.forest <- sort(unique(as.character(data.long$forest))) superpose.polygon <- trellis.par.get("superpose.polygon") superpose.polygon$col <- gray(1:n.spc / n.spc) trellis.par.set("superpose.polygon", superpose.polygon) func.strip <- function(which.panel, ...) { lrect(0, 0, 1, 1, col = "#eeeeee") ltext(0.5, 0.5, v.forest[which.panel]) } print( barchart( n ~ treatment | forest, groups = spc, data = data.long, stack = TRUE, auto.key = list( points = FALSE, lines = FALSE, rectangles = TRUE, space = "right", reverse.rows = TRUE ), ylab = "", layout = c(length(v.forest), 1), strip = func.strip ) ) }