[R] Stacked barchart color

Dieter Menne dieter.menne at menne-biomed.de
Tue Jun 12 19:57:03 CEST 2007


Dear Latticer,

I want to give individual colors to all elements in a simple stacked
barchart. I know why the example below does not work (and it is a excellent
default), but is there any workaround for this?

Dieter


# This only colors red and green, but I want blue and gray for Peatland.

barchart(yield ~ variety , groups=year, data = barley,  stack = TRUE,
  subset=site=="Grand Rapids" & variety %in% c("Velvet","Peatland"),
    col=c("red","green","blue","gray"))



More information about the R-help mailing list