[R] lattice and legend

Dieter Menne dieter.menne at menne-biomed.de
Mon Jan 18 15:05:47 CET 2010




robert-mcfadden wrote:
> 
> I use lattice package to produce a bar chart. I set my.kolor for bars and
> it displays properly but I have a problem with legend color. It behaves as
> if I didn't set my.colors - the colors differs. How to work it out?     
> 
> barchart(Counts ~ Purchase | Products , data = my.data, groups = Model,
> col=my.kolor,horizontal=FALSE,layout=c(1,4),
> auto.key=list(rectangles = TRUE, space = "bottom"),scales = list(y =
> "free"))
> 
> 

The very short answer by Deepayan is in 
http://markmail.org/message/ptoj6ylnt432odbw

a longer one at
http://markmail.org/message/72tavcpaoqg4nhn2

Searching for "barchart legend color" gives about  20 references. Please use
data sets that are reproducible, not your private data, for example

library(lattice)
col= c("red","green") 
barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6),
         col= col,
         auto.key=list(rectangles = TRUE, space = "bottom",col=col)
         )

Dieter
 


-- 
View this message in context: http://n4.nabble.com/lattice-and-legend-tp1016615p1016644.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list