title: Reordering forested model variables in sjPlot with plot_models (r)
body: <p>I have a group of models that I am plotting together in R using the <code>plot_models</code> function from the <code>sjPlot</code> package. The models are plotting confidence intervals for similar <code>felm</code> regressions that use different datasets. All the models share the same variables of interest, and their confidence intervals occupy the same ranges. I have successly plotted all of the models, however, I now cannot order them how would be ideal.</p>
  <p>My code is the following:</p>
  <pre><code>placebo_models &lt;- paste0(&quot;outcome&quot;, 1:13, &quot; ~ Variable1 + Variable2 | fe_variable |0| fe_variable&quot;) |&gt; lapply(\(x) felm(as.formula(x), data = df))
  
  
  models_list &lt;- list(placebo_models[[13]], placebo_models[[12]], placebo_models[[11]], placebo_models[[10]], placebo_models[[9]], placebo_models[[8]], placebo_models[[7]], placebo_models[[6]], placebo_models[[5]], placebo_models[[4]], placebo_models[[3]], placebo_models[[2]], placebo_models[[1]])
                    
  testplot &lt;- plot_models(models_list, colors = c(&quot;RED&quot;), show.values = TRUE, p.threshold = 0.05, spacing = 0.8, dot.size = 1, digits = 5, title = &quot;Placebo Models&quot;, axis.labels = c(&quot;Variable1&quot;, &quot;Variable2&quot;)) + scale_color_discrete(labels = c(&quot;m1&quot;, &quot;m2&quot;, &quot;m3&quot;, &quot;m4&quot;, &quot;m5&quot;, &quot;m6&quot;, &quot;m7&quot;, &quot;m8&quot;, &quot;m9&quot;, &quot;m10&quot;, &quot;m11&quot;, &quot;m12&quot;, &quot;m13&quot;))
  </code></pre>
  <p>My current plot output is the following:</p>
  <p><a href="https://i.stack.imgur.com/VNuvB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VNuvB.png" alt="Plot" /></a></p>
  <p>Ideally, I would like to change this model to report in order (descending from the top) m1's Variable 1 confidence interval, followed by m1's Variable 2 confidence interval, before going to m2 (Variable1, then Variable2), m3 (Variable1, then Variable2), etc.</p>
  <p>Is there a way to reorder the plotted lines such that this is possible? The variables are identical across all the models, so it should fit, as long as it can be restructured. Can the variables of different models be reordered and inter-mixed within the same plot like so?</p>
  <p>I am unfortunately not able to share the original data, but this visualization should explain the problem. Many thanks!</p>