title: How to sort and color pointranges in plot with facet grid and position dodge?
body: <p>I have a facet gridded plot of two groups of fixed effects models. In group one I want to suppress the control variable (shown green). In group two I want to show the control variables if there is one in the model with a <code>position_dodgev()</code>.</p>
  <p>So far I figured out this code:</p>
  <pre><code>library(ggplot2)
  library(ggstance)
  ggplot(mf, aes(fill=mn)) +
    geom_vline(xintercept=0) +
    geom_pointrangeh(aes(y=mn, x=coef, group=cv, color=cv, 
                         xmin=coef - se*1.96, xmax=coef + se*1.96),
                     position=position_dodgev(.5),
                     show.legend=FALSE) +
    scale_color_manual(values=c(&quot;green&quot;, &quot;red&quot;, &quot;green&quot;, &quot;red&quot;)) +
    facet_grid(gr ~ ., scales=&quot;free&quot;, space=&quot;free&quot;)
  </code></pre>
  <p>which gives me this:</p>
  <p><a href="https://i.stack.imgur.com/4n4v1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4n4v1.png" alt="enter image description here" /></a></p>
  <p>However, in model 1 the explanatory variable is duplicated and the explanatory variable in the models of group 2 are not always on top.</p>
  <p>I actually want to look the plot like this (photoshopped):</p>
  <p><a href="https://i.stack.imgur.com/FWzxv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FWzxv.png" alt="enter image description here" /></a></p>
  <p>How would that be possible with <code>ggplot()</code>?</p>
  <hr />
  <h3><em>Data</em></h3>
  <pre><code>mf &lt;- structure(list(coef = c(3.025, 0.762499999999999, -1.44237073106609, 
  -0.125042600081792, -0.689108910891089, 2.64264321029771, 2.64264321029771
  ), se = c(5.26319027539381, 3.34469904756018, 2.02098677878979, 
  2.02098677878979, 2.02098677878979, 0.763989041657158, 0.763989041657158
  ), mn = structure(c(1L, 1L, 2L, 2L, 3L, 4L, 4L), .Label = c(&quot;Model 2c&quot;, 
  &quot;Model 2b&quot;, &quot;Model 2a&quot;, &quot;Model 1&quot;), class = &quot;factor&quot;), gr = c(2, 
  2, 2, 2, 2, 1, 1), cv = structure(c(2L, 1L, 2L, 3L, 2L, 2L, 3L
  ), .Label = c(&quot;gear&quot;, &quot;vs&quot;, &quot;disp&quot;), class = &quot;factor&quot;)), row.names = c(&quot;vs&quot;, 
  &quot;gear&quot;, &quot;vs1&quot;, &quot;disp&quot;, &quot;1&quot;, &quot;11&quot;, &quot;2&quot;), class = &quot;data.frame&quot;)
  </code></pre>