Hi, 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. For example, ### I have this dataset height = cbind(x = c(465, 91) / 465 * 100, y = c(840, 200) / 840 * 100, z = c(37, 17) / 37 * 100) ### and use this plot barplot(height, beside = FALSE, horiz=T, col = c(2, 3) ) how can I put the values from height within the respective stacked bars? Thank you! -- +++++++++++++++++++++++++++++++++++++++++ Dipl.Biol. Jens Oldeland Biodiversity of Plants Biocentre Klein Flottbek and Botanical Garden University of Hamburg Ohnhorststr. 18 22609 Hamburg, Germany Tel: 0049-(0)40-42816-407 Fax: 0049-(0)40-42816-543 Mail: Oldeland at botanik.uni-hamburg.de Oldeland at gmx.de (for attachments > 2mb!!) Skype: jens.oldeland http://www.biologie.uni-hamburg.de/bzf/fbda005/fbda005.htm http://jensoldeland.wordpress.com +++++++++++++++++++++++++++++++++++++++++
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