geom-text
Add percentage labels to a stacked barplot
This would give you the asnwer: ggplot(example.melt, aes(x=example.Category, y=value, fill = variable)) + geom_bar(position = “fill”, stat = “identity”,color=”black”,width=0.9) + scale_y_continuous(labels = scales::percent) + geom_text(aes(label = paste0(value*100,”%”)), position = position_stack(vjust = 0.5), size = 2) Plot would look like this:
geom_text how to position the text on bar as I want?
Edit: The easier solution to get hjust/vjust to behave intelligently is to add the group aesthetic to geom_text and then hjust & position adjust for the group automatically. 1. Vertical Orientation ggplot(data) + geom_bar( aes(x = name, y = count, fill = week, group = week), stat=”identity”, position = ‘dodge’ ) + geom_text( aes(x = … Read more
How to add frequency count labels to the bars in a bar graph using ggplot2? [duplicate]
ggplot(data=diamonds, aes(x=clarity)) + geom_bar() + geom_text(stat=”count”, aes(label=..count..), vjust=-1)