您好我正在尝试让此图表显示其上方每个栏的计数
sumrc<-ggplot(subset(longdata,!is.na(summresolution)),
aes(x=summresolution, fill=summresolution))
sumrcbycount <- sumrc +
geom_bar(stat = "count") +
coord_flip() +
scale_fill_brewer(palette="Paired")+
theme(axis.title.x=element_blank(),axis.title.y=element_blank(),legend.title = element_blank(),legend.position = 'none')
我觉得我应该使用geom_text()
,但老实说不知道该怎么做,所有的例子似乎都在使用stat= identity
。我是R的新手,所以请你解释一下。
编辑*这里是我正在构建图形的向量的一部分,整体数据集很大,所以这应该足够了。
summresolution = c("Resolved by current supplier", "Resolved by current supplier",
"Resolved by current supplier", "Supplier educated", "Beneficiary Educated",
"Supplier educated", "Beneficiary Educated", "Beneficiary Educated",
"Beneficiary Educated", "Beneficiary Educated", "Beneficiary Educated",
"Unresolved", "Unresolved", "Beneficiary Educated", "Resolved by current supplier",
"Resolved by current supplier", "Beneficiary Educated", "Beneficiary Educated",
"New supplier Found", "Beneficiary Educated")