title: how invert the order of factors in ggplot
body: <p>I am trying to reverse the order of the fill factor on the graph, i.e. The 0.5-1 class, must be at the top of the bar.. and then in descending order</p>
  <pre><code>gruppo &lt;- c(&quot;TM&quot;, &quot;TM&quot;,&quot;TM&quot;,&quot;TM&quot;, &quot;PM&quot;, &quot;PM&quot;,&quot;PM&quot;,&quot;PM&quot;)
  valor &lt;-c(1,4,237,3433,1,3,240,3700)
  class &lt;- c(&quot;&gt;1&quot;, &quot;0.5-1&quot;, &quot;0.1-0.5&quot;, &quot;&lt;0.1&quot;)
  df &lt;- data.frame(Trait=gruppo, n_windows=valor, var_exp =class)
  library(ggplot2)
  ggplot(df, aes(x= Trait, y=n_windows, fill=var_exp)) + geom_bar(stat= &quot;identity&quot;)
  </code></pre>
  <p>I tried the reorder function, but don't work</p>
  <pre><code>ggplot(df, aes(x=reorder(Trait, y=n_windows), fill=var_exp)) + geom_bar(stat= &quot;identity&quot;)
  </code></pre>