[R] legend color problems

From: Heidemeier Dr, Joachim <joachim.heidemeier_at_uba.de>
Date: Tue, 18 Nov 2008 11:06:26 +0100

I don't get the color of the legend in a lattice-plot right. I select a palette from RColorBrewer and use it in the barchart plot.

The resulting graph shows the new palette in the graph, but in the legend rectangles the standard palette is used. Adding a col argument into auto.key uses the new palette

with the legend text, but not in the rectangle fill.

What am I missing?

TIA Joachim

---------code ---------



# palette auswählen

mypalette <- brewer.pal(7,"Accent")

pathBarchartFGE <- function(selector,data,dimension = 2,title = NULL,p = mypalette) {

# umwandeln für lattice Grafiken

dfvar <- as.data.frame.table(data)

names(dfvar) <- c("Zeitraum","FGG","Pfad","Fracht")

dfsel <- subset(dfvar,dfvar$FGG %in% selector)

barchart(Zeitraum ~ Fracht | FGG, layout = c(1,3), groups = Pfad, stack = TRUE , col = p,

data = dfsel, xlab = "Einträge (t/a)",auto.key = list(title = "Pfade",columns = 2,space = "bottom"),main = title)


Dr. Joachim Heidemeier
c/o Umweltbundesamt FG II 2.2
Tel.: +49340 2103-2780
eMail: joachim.heidemeier_at_uba.de

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 18 Nov 2008 - 10:27:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Nov 2008 - 12:30:26 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.

list of date sections of archive