I plotted a facet plot using ggplot and here is the plot
The problem I have is, The facets(labels) are sorted alphabetically (Ex: E1, E10, E11,E13, E2, E3, I1, I10, I2) but I need them to be a custom order like E1, I1, E2, I2, E3, E10, I10, E11, E13.
How can I do that ?
Don’t rely on the default ordering of levels imposed by
factor()or internally byggplotif the grouping variable you supply is not a factor. Set the levels explicitly yourself.What if I want them in this arbitrary order?
To do this, set the levels the way you want them.
Now we can use this to have the panels drawn in the order we want:
Which produces: