How do I get ggplot to order facets correctly?

前端 未结 2 1916
你的背包
你的背包 2020-12-05 20:23

I am trying to facet about 14 plots based on a variable that runs from 2-14. The plots show up in the order: 10,11,12,13,14,15,2,3,4,5,6,7,8,9

How do I get them to

相关标签:
2条回答
  • 2020-12-05 20:46

    Without your data, my best guess would be to turn your faceting variable into a factor that has the levels in the order which you desire.

    0 讨论(0)
  • 2020-12-05 20:57
    data$var <- factor(data$var, levels = sort(unique(data$var)))
    
    0 讨论(0)
提交回复
热议问题