0

I want to plot following dataframe with week vs amount starting with week7 in x -axis.

df <- data.frame(week = c("w7","w8","w9","w10","w11","w12"),
             amount = c(34,56,78,90,12,23),
             outlier = c(0,0,0,1,0,0))

 week amount outlier
 w7     34       0
 w8     56       0
 w9     78       0
 w10    90       1
 w11    12       0
 w12    23       0

But the plot starts with w10. How to ensure that it starts with w7.

ggplot(data = df, aes(x = week, y = amount, col = outlier)) +
    geom_point() +
    scale_x_discrete(guide = guide_axis(angle = 90))
joy_1379
  • 487
  • 3
  • 17

0 Answers0