首页 > 解决方案 > GGplot 2:如何在条形图中从最大到最小设置x轴

问题描述

我知道很多人都问过这个问题,但由于问题与我的不同,我发现答案太混乱了。目前,当我希望它们从最大到最小排序时,我的 x 值(物种)只是随机排序的。

代码:

ggplot(moth.abundance, aes(x=Species, y=Total)) +geom_bar(stat='identity')+theme_classic()+labs(x='Moth Species', y='Count')+
  theme(axis.text.x = element_text(angle = 90))

参考图片:https ://i.stack.imgur.com/WbGmo.png

标签: rggplot2graph

解决方案


推荐阅读