title: R ggplot2 geom_bar barplot: order bars by count without modifying dataframe and where factor labels have a meaning
body: <h1>Problem</h1>
  
  <p>My question is very simple, but apparently unanswered. I have a count barplot and I simply want to order the bars based on their count. However
  1. I don't want to modify the original dataframe, that is unnecessary, and in more complicated examples it would be way too long to do.
  2. I don't want to change the order without changing the actual underlying order of the labels. In the MWE below, for instance, I dont want to change the genres that artists belong to (which is what literally every other answer on StackOverflow suggests to do).</p>
  
  <h1>Minimal Working Example</h1>
  
  <pre><code>library(ggplot2)
  # Create data
  df &lt;- data.frame(genre=c("Pop", "HipHop", "Latin", "Pop", "Pop", "HipHop"), artist=c("ArianaGrande", "ChrisBrown", "DaddyYankee", "EdSheeran", "LewisCapaldi", "ShawnMendes"))
  # Plot
  ggplot(data=df) +
    geom_bar(aes(x=genre, fill=artist))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/pQw7L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pQw7L.png" alt="plot"></a></p>
  
  <p>How do I order the bars, keeping everything else the same? Surely this should happen at the plot level, not at the dataframe level, nor at the "input" level of ggplot.</p>