43
我已经浏览了此论坛中的答案,但似乎无法找到对此特定问题的答案。我有以下数据,并希望创建一个条形图,其中条从最大到最小的“价值”来排序,而不是按字母顺序让他们:ggplot中的酒吧排序
breadth_data <- read.table(textConnection("Stakeholder Value
'Grantseekers' 0.90
'Donors' 0.89
'Community' 0.55
'Hurricane Relief Fund' 0.24
'Media' 0.19
'Employment Seekers' 0.12
'Affiliates' 0.10
'Youth' 0.09
'Women' 0.02
'Former Board Members' 0.01"), header=TRUE)
那么基本条形图:
c <- ggplot(breadth_data, aes(x=Stakeholder, y=Value))
c + geom_bar(stat="identity") + coord_flip() + scale_y_continuous('') + scale_x_discrete('')
我已经尝试了很多不同的重排序和转换,我看到StackOverflow但我似乎无法找到一个工程。我相信这很简单,但我会很感激任何帮助!
感谢,
格雷格
或者使用电话里'-Value'为'reorder'扭转方向。 –
@Richie - 当然(拍拍脸!) - 显然不会直视这个arvo! –
谢谢,@Gavin和@Richie!完善!我很感激帮助。 –