Adding percentage labels to ggplot when using stat_count
问题 For some reason, I can't seem to be able to add correct proportion labels to a ggplot by using stat_count . The code below returns labels that display 100% for all categories, even though I'm using ..prop.. . Should I use something else instead of stat_count ? library(tidyverse) diamonds %>% ggplot(aes(color, fill=cut)) + geom_bar(position = 'fill') + stat_count(aes(label= scales::percent(..prop..)), geom = 'text', position = position_fill(vjust = 0.5)) I know this can also be accomplished by