title: How to order facets by variable in ggplot2?
body: <p>Suppose I have a graph like this:</p>
  <pre><code>library(tidyverse)
  
  df &lt;- mtcars %&gt;%
    group_by(cyl, gear) %&gt;%
    summarise(hp_mean = mean(hp))
  
    ggplot(df, aes(x = gear, y = hp_mean)) +
    geom_point(size = 2.12, colour = &quot;black&quot;) +
    theme_bw() +
    facet_wrap(vars(cyl))
  
  </code></pre>
  <p>and would like to arrange the order of facets, according to the hp_mean value for gear=3. E.g. the facet with cyl=8 should be first as hp_mean for gear=3 is 194 which is the highest.
  Any ideas?
  All help is much appreaciated!</p>