填充中没有显示填充的百分比

时间:2017-07-17 18:48:39

标签: plot ggplot2

我有一个看起来像这样的条形图: enter image description here

我已经使用了以下代码:

ggplot(dffinal, aes(x = Vertical)) +
geom_bar(aes(y = (..count..)/sum(..count..),fill=Reasons)) +
geom_text(aes(y = ((..count..)/sum(..count..)), label = 
scales::percent((..count..)/sum(..count..))), stat = "count", vjust = -0.25) 
+scale_y_continuous(labels =scales::percent) 

但是我想要在每次填充中显示单个填充的值。此代码仅显示顶部的总百分比。我该怎么办?

0 个答案:

没有答案