0

I am quite new in ggplot and I have a question to relabelling the x-axis.

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

but the result is

Income Distribution for Females with the wrong x-axis order

I want a result like this

Income Distribution for Females with the right x-axis order

Jee Mok
  • 6,157
  • 8
  • 47
  • 80
  • Hi Shkileo, can you add some of your data for Income Distribution? I suspect its type is of character which does not go well with plots. – dswdsyd Oct 13 '19 at 04:03
  • Possible duplicate of [Order Bars in ggplot2 bar graph](https://stackoverflow.com/questions/5208679/order-bars-in-ggplot2-bar-graph) – camille Oct 13 '19 at 04:31
  • Possible duplicate of [Change the order of a discrete x scale](https://stackoverflow.com/questions/3253641/change-the-order-of-a-discrete-x-scale) – GordonShumway Oct 13 '19 at 04:54

1 Answers1

0

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)