I have a data frame with 5 groups. I want to facet my data by group using ggplot. I need the panels to be ordered from right to left, and not from left to right (the default).
df <- data.frame(group=letters[1:5],
x=1:5,
y=1:5)
ggplot(df, aes(x,y)) +
geom_point(size=3) +
facet_wrap(~group)
By default the panels are ordered from left to right, so that group 'a' appears at the top-left of the graph. The panel at the bottom-right is empty (as there are only 5 groups). I want the panels to appear from right to left. That is, 'a' should appear at the top-right and the panel at the left-bottom should be empty. Any ideas?
Note: the question is not about the labels of the panels. It is also not about re-ordering the group with factor(). I looked at the facet_wrap() help, but the only options are the 'switch' and 'strip.position' arguments that deal with labels. The 'dir' argument allows vertical or horizontal position, which is not what I am looking for.
Thanks in advance