如何使用条形图向x轴标签添加百分比

时间:2019-04-21 12:41:42

标签: r

我想为标签添加百分比,如下所示: enter image description here

我的数据:

> d
    ClientType Param4
 1:          A  Type3
 2:          B  Type3
 3:          A  Type3
 4:          B  Type3
 5:          A  Type3
 6:          B  Type2
 7:          A  Type1
 8:          B  Type2
 9:          A  Type1
10:          B  Type2
11:          A  Type1
12:          B  Type2
13:          A  Type1
14:          C  Type2

我的代码是:

# plot for A
ggplot(data=subset(d, ClientType == "A"), aes(x = fct_rev(fct_infreq(Param4)), fill=Param4)) 
+geom_bar(position="dodge",fill="#3399FF") 
+ theme_minimal() 
+ coord_flip() 

我现在的情节: enter image description here

任何评论都可能有所帮助!谢谢!

0 个答案:

没有答案
相关问题