title: ggplot2 different facet width for categorical x-axis
body: <p>I have am plotting different facets of categorical data:</p>
  
  <pre><code>df &lt;- as.data.frame(as.factor(c("A","B","C","D","E","F")))
  names(df) &lt;- "Xvar"
  df$Yvar &lt;- c(2,1,4,5,3,7)
  df$facet &lt;- c(rep("facet 1",2),rep("facet 2",4))
  
  ggplot(df, aes(x=Xvar, y=Yvar, group=1)) +
    geom_line() +
    facet_wrap(~facet, scales="free_x")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/EZ2yX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EZ2yX.png" alt="enter image description here"></a></p>
  
  <p>How can I make it such that facet 1 consisting of only two categories is half the size of facet 2 containing four categories? I.e. that the width of each facet is proportional to the number of categorical x-axis data points? I tried <code>scales="free_x"</code> to no avail.</p>