Skip to content
Prev 178175 / 398502 Next

displaying percentage in bar plot

region),
easy
Try this:
x <- matrix(c(10,15,15,25,20,15), ncol=3)
pct <- apply(x, 1, function(x) 100*x[1]/sum(x))
custompanelfn <- function(...)
{
   panel.barchart(...)
   panel.text(x=c(5,5), y=c(1,2),paste(format(pct, digits=3),"%", sep=""))
}
library(lattice)
barchart(x, panel=custompanelfn)

Regards,
Richie.

Mathematical Sciences Unit
HSL



------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}