I have stacked bar charts with total frequency, and I simply want to add the percentage for each category in the graph (see link with image below). In other words, I just want to show the percentage for each category below the number that is now reported. For example, instead of seeing "170" in the first bar, I would like to see "170 (85.4%)"; instead of "29", I would like to see "29 (14.6%)"; etc.
This is the code I have now
networkmeasured <- data.frame(supp=rep(c("Article measures network",
"Article does not measure network"), each=2), Type=rep(c("loosely about
collab. gov.", "striclty about colla. gov"),2), Articles=c(29, 44, 170, 96))
head(networkmeasured)
#plotting the graph
ggplot(data=networkmeasured, aes(x=Type, y=Articles, fill=supp)) +
geom_bar(stat="identity")+
geom_text(aes(label=Articles), vjust=2, color="white", size=4)+
theme_minimal()
Thanks in advance!
RB.