-4

here is an example of my data:

test = data.frame(month_year = c("MAR13","APR13","MAY13","JUN13"),
                  turnover = c(10,15,25,10))

Here is my plot:

ggplot(data = test,
       aes(x = month_year,
       y = turnover,
       group = 1))+
  geom_line()

Now my question is why is the X-axis sorted alphabetically and how can I prevent it, because as you can see it makes no sense.

Thank you!

burton030
  • 387
  • 3
  • 6
  • 22

1 Answers1

1

Just use :

test = data.frame(month_year = factor(c("MAR13","APR13","MAY13","JUN13"),levels=c("MAR13","APR13","MAY13","JUN13")),
              turnover = c(10,15,25,10))

enter image description here

Maju116
  • 1,567
  • 12
  • 29