Hi,
you can use par.settings to get a consistent color scheme,
pal1 <- rgb(196, 255, 255, max = 255)
pal2 <- rgb( 0, 35, 196, max = 255)
df <- data.frame( Gruppe = c("A", "B", "A", "B"),
Kat = c("x1", "x1", "w1", "w1"),
value= c(1,2, 4, 5))
barchart(value ~ Kat, group= Gruppe,
par.settings = list(superpose.polygon = list(col=c(pal1, pal2)) ),
panel = function(y,x,...){
panel.barchart(x,y, ...)
}, data = df,
auto.key = list(points = FALSE, rectangles = TRUE,
columns = 2, space = "bottom")
)
HTH,
baptiste
On 24 Sep 2008, at 11:37, Patrick Hausmann wrote:
Dear list,
with the code below I produce the right graph, but the colours of
the legend are different from the colours of the graph. The colours
of the graph are the desired colours.
Thanks for any help.
Patrick
library(lattice)
pal1 <- rgb(196, 255, 255, max = 255)
pal2 <- rgb( 0, 35, 196, max = 255)
df <- data.frame( Gruppe = c("A", "B", "A", "B"),
Kat = c("x1", "x1", "w1", "w1"),
value= c(1,2, 4, 5))
barchart(value ~ Kat, group= Gruppe,
panel = function(y,x,...){
panel.barchart(x,y, ..., col=c(pal1, pal2))
}, data = df,
auto.key = list(points = FALSE, rectangles = TRUE,
columns = 2, space = "bottom")
)
______________________________________________
R-help@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.
_____________________________
Baptiste AuguiƩ
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
______________________________________________
R-help@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.