title: How do I reorder based on descending order for a specific variable in a grouped bar plot
body: <p>I am trying to reorder the graph bars based on one of the variables, in this case the y variable in descending order instead of the alphabetical order of x.</p>
  <pre><code>x&lt;-c(&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;)
  y &lt;- c(2000, 23400, 26800)
  z&lt;-c(1100,5000,6000)
  df&lt;-data.frame(x,y,z)
  View(df)
  
  library(reshape2)
  library(ggplot2)
  
  df.long&lt;-melt(df)
  ggplot(df.long,aes(x=x, y=value,fill=variable))+geom_col(position = &quot;dodge&quot;, width=0.9)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/eG5dW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eG5dW.png" alt="The current plot that I have is this:" /></a></p>
  <p><a href="https://i.stack.imgur.com/I8Toj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I8Toj.png" alt="I am hoping to plot a graph like this below:" /></a></p>
  <p>The first plot is before reordering using the script above, and I am hoping to plot a graph similar to the second one. I would really appreciate some guidance here. Thank you.</p>