简体   繁体   English

在ggplot中重新排序货币x轴

[英]reorder currency x-axis in ggplot

I am quite new in ggplot and I have a question to relabelling the x-axis.我是 ggplot 的新手,我有一个重新标记 x 轴的问题。

ggplot(female_income)+geom_bar(mapping=aes(x=household_income))

but the result is但结果是

x 轴顺序错误的女性的收入分配

I want a result like this我想要这样的结果

具有右 x 轴顺序的女性收入分配

Thank you all for comments, I found the way to solve it in a similar question.谢谢大家的评论,我在类似的问题中找到了解决方法。

positions = c("$0 - $24,999", "$25,000 - $49,999", "$50,000 - $99,999","$100,000 - $149,999")

ggplot(female_income)+geom_bar(mapping=aes(x=household_income))+scale_x_discrete(limits = positions)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM