[R] Lattice barchart legend with panel.barchart

Seth Bigelow sbigelow at jonesctr.org
Wed Jul 27 23:02:01 CEST 2016


I have constructed a barchart that requires a panel call, but the panel
reduces the facsimiles of bars in the legend to small colored circles. You
can see this behavior in the following example:

Titan <- as.data.frame(Titanic)

titanpanel <- function(x,y,...){
panel.barchart(x,y,...)
}

barchart(Class~Freq|Sex + Age, Titan,
groups=Survived,
panel = titanpanel,
stack=TRUE, layout=c(4,1),
auto.key=list(title="Survived", columns=2))

...if you comment out the panel and run the barchart statement you will see
nice blocks displayed in the legend. Is there any easy way to retain these
blocks with panel.barchart?


-- 
Seth W. Bigelow, Ph.D.
Assistant Scientist of Forest Ecology
Joseph W. Jones Ecological Research Center
Newton, GA

	[[alternative HTML version deleted]]



More information about the R-help mailing list