我在此条形图中重新排序条形图时遇到问题。这是我的代码:
ggplot(Issues103, aes(IssueNew)) +
geom_bar(aes(y = (..count..)/sum(..count..))) +
geom_text(aes(y = ((..count..)/sum(..count..)),
label = scales::percent((..count..)/sum(..count..))),
stat = "count", vjust = -0.25, size = 3.2) +
scale_y_continuous(labels=scales::percent) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(title = "Issues Discussed in WIR Speeches: 103rd Congress", x = "Issue", y = "Percentage of WIR Speeches")
这让我:
我想按降序按百分比重新排序。我到处寻找,但是当y =(..count ..)/ sum(.. count ..)时,我无法弄清楚如何做到这一点。
我对所有这一切都很陌生,所以感谢您的帮助!