[R] Ordering of facet_wrap() panels

Stats Student @t@t@@@tudent4647 @ending from gm@il@com
Wed Aug 15 16:21:55 CEST 2018


Hi, I am generating multiple charts with facet_wrap() and what what I see, R/ggplot sorts the panels by the facet variable. So adding an index to the facet variable (1 - bucket, 2 - bucket, etc) does solve the sorting issue but it's ugly. 

I also read this post which, if I understand correctly, claims that ggplot should be using the initial ordering of the data for ordering the charts (instead of ordering the data itself). 

https://mvuorre.github.io/post/2016/order-ggplot-panel-plots/

Wondering if anyone knows how to direct ggplot use the initial sorting of the data to order the panels. 

Thank you.



More information about the R-help mailing list