[R] R graphics: Add labels to stacked bar chart

Jim Lemon jim at bitwrit.com.au
Thu Sep 2 13:30:33 CEST 2010


On 09/02/2010 08:50 PM, Jens Oldeland wrote:
 > ...
 > I am looking for a way to add labels, i.e. absolute values, into a
 > stacked bar chart using the basic plot functions of R. The labels
 > should be inside the stacked bars.

barpos<-barplot(height,beside = FALSE,
  horiz=TRUE,col = c(2, 3))
library(plotrix)
boxed.labels(c(height[1,]/2,height[1,]+height[2,]/2),
  rep(barpos,2),c(height[1,],round(height[2,],1)))

Jim



More information about the R-help mailing list