title: Order nested facet labels in facet_grid
body: <p>So, I am trying to make a grid of plots that are faceted by three different variables. I can generate the grid of plots just fine, the only hitch I am having is that the order in which the labels is placed seems out of order. Here is a simple example of what I am doing:</p>
  
  <pre><code>library(ggplot2)
  data(mtcars)
  qplot(mpg, wt, data=mtcars) + facet_grid(cyl +am ~ vs, labeller = label_both)
  </code></pre>
  
  <p>which produces the following plot:</p>
  
  <p><a href="https://i.stack.imgur.com/zca2t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zca2t.jpg" alt="enter image description here"></a></p>
  
  <p>Now, for the most part, the plot looks great, but for the labels on the right hand side, we see that <i>cyl</i>  is labeled "first" (i.e. close to the plot) and <i>am</i> is nested outside, but the way the plot is laid out, it is clear that the facets are displayed with <i>am</i> nested within <i>cyl</i>. </p>
  
  <p>So, I would like to change the order that the labels are listed so that <i>am</i> levels are listed within <i>cyl</i> levels to reflect the layout. I have tried to search for things like "facet_grid order labels" or "nested facet label order ggplot2", but almost all of the results I found had to do with changing the order of the actual levels of a given facet, rather than the problem I have described. Additionally, I looked into tinkering with the labeller, but that function seems to be called after the placement of the labels has been decided.</p>
  
  <p>Thanks for your help!</p>