Dear All,

 

I have created a barchart, but the legend created by auto.key does not match
the actual graph. Can someone give me some hint here?

 

For example, my coding are:

 

Library(lattice)

dataset.table <-
table(data.frame(id=c("a","b","c","a","c","b","a"),colour=c("blue","green","
red","red","red","green","green")))

blue<-hcl(238,60,100)

green<-hcl(120,70,100)

violet<-hcl(350,100,100)

barchart(rbind(dataset.table),horizontal =
FALSE,col=c(blue,green,violet),stack=FALSE, auto.key=TRUE)

 

 

As you can see, the actual plot, the color is blue, green then violet, but
in the legend, it is blue, violet and green. Can someone help me correct the
legend colour?

 

 

Thanks a lot.

 

Rene.

 

 

 

 


	[[alternative HTML version deleted]]


