[R] Trellis stacked bar legend

Dieter Menne dieter.menne at menne-biomed.de
Wed Mar 8 15:19:25 CET 2006


Dear R-Listers,
(well... called Depayan)

The standard example 

barchart(yield ~ variety | site, data = barley,
    groups = year, layout = c(1,6), stack = TRUE,
    auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),
    ylab = "Barley Yield (bushels/acre)",
    scales = list(x = list(rot = 45)))

shows the problem: legend colors are inverted compared to stack colors. 
This is still acceptable with 2 colors, but with 3 or more, people 
ask me why it's partly down-under. I use to mumble that one
author is in New Zealand, the other either in India or in Wisconsin.

I know the hard way to correct this, but auto.key is nice because
it's print-time settings dynamic. Any easy workaround?

Dieter




More information about the R-help mailing list