title: ggplot2: Deleting facets of unused factor level combinations from a plot (facet_grid)
body: <p>I would like to selectively delete unnecessary facets from a facetted ggplot2 figure. I had a look at this question but could not figure out how to do it (maybe the advise there is outdated now):</p>
  
  <p><a href="https://stackoverflow.com/questions/30372368/adding-empty-graphs-to-facet-wrap-in-ggplot2">adding empty graphs to facet_wrap in ggplot2</a></p>
  
  <p>Here is a minimal example. I would like to remove the empty facet at the right bottom (b, 2).</p>
  
  <pre><code>library('ggplot2')
  d &lt;- data.frame('factor_1' = factor(c('a', 'a', 'b')),
                  'factor_2' =    factor(c('1', '2', '1')),
                  x = 1:3, y = 1:3)
  
  ggplot(data = d, mapping = aes(x = x, y = y)) +
    geom_point() +
    facet_grid(facets = factor_1 ~ factor_2, drop = TRUE)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Rt4uH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rt4uH.png" alt="enter image description here"></a></p>
  
  <p>Obviously <code>drop = TRUE</code> has no effect here because there are no unused factor levels but only unused combinations thereof.</p>