[R] lattice and legend

robert-mcfadden at o2.pl robert-mcfadden at o2.pl
Mon Jan 18 16:01:15 CET 2010


Thank you very much. In an example given by you it sufficient to add:
par.settings = simpleTheme(col = my.col)
Maybe someone else find it helpful.    
  
library(lattice)
 my.col= c("red","green") 
 barchart(yield ~ variety | site, data = barley,
          groups = year, layout = c(1,6), col= my.col,
          auto.key=list(rectangles = TRUE, space = "bottom"),
          par.settings = simpleTheme(col = my.col)
          )




Dnia 18 stycznia 2010 15:05 Dieter Menne <dieter.menne at menne-biomed.de> napisał(a):

> 
> 
> 
> 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.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list