I frequently have to produce stacked bar plots with labels. The way I've been coding the labels is very time intensive and I wondered if there was a way to code things more efficiently. I would like the labels to be centered on each section of the bars. I'd prefer base R solutions.

```
stemdata <- structure(list( #had to round some nums below for 100% bar

A = c(7, 17, 76), 
B = c(14, 10, 76),
C = c( 14, 17, 69),
D = c( 4, 10, 86), 
E = c( 7, 17, 76),
F = c(4, 10, 86)), 

.Names = c("Food, travel, accommodations, and procedures",
         "Travel itinerary and dates",
        "Location of the STEM Tour stops",
         "Interactions with presenters/guides",
         "Duration of each STEM Tour stop",
        "Overall quality of the STEM Tour"
         ), 
class = "data.frame", 
row.names = c(NA, -3L)) #4L=number of numbers in each letter vector#

# attach(stemdata)
print(stemdata)
par(mar=c(0, 19, 1, 2.1)) # this sets margins to allow long labels
barplot(as.matrix(stemdata), 

    beside = F, ylim = range(0, 10), xlim = range(0, 100),
    horiz = T, col=colors,  main="N=29", 
    border=F, las=1, xaxt='n', width = 1.03)

text(7, 2, "14%")
text(19, 2, "10%")
text(62, 2, "76%")

text(7, 3.2, "14%")
text(22.5, 3.2, "17%")
text(65.5, 3.2, "69%")

text(8, 4.4, "10%")
text(55, 4.4, "86%")

text(3.5, 5.6, "7%")
text(15, 5.6, "17%")
text(62, 5.6, "76%")

text(9, 6.9, "10%")
text(55, 6.9, "86%")

```