title: Error when ordering grouped bars in ggplot2
body: <p>My data is in the long format (as required to do the grouped barplot), so that the values for different categories are in one single column. The data is <a href="https://ethercalc.org/c3r94glgm9o2" rel="nofollow noreferrer">here</a>. </p>
  
  <p>Now, a standard barplot with ggplot2 orders the bars alphabetically (in my case of country names, from Argentina to Uganda). I want to keep the order of countries as it is in the dataframe. Using the suggestion <a href="https://stackoverflow.com/questions/5208679/order-bars-in-ggplot2-bar-graph">here</a> (i.e. ussing the <code>limits=</code> option inside the <code>scale_x_discrete</code> function) I get the following graph:</p>
  
  <p><a href="https://i.stack.imgur.com/Lvkz8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lvkz8.png" alt="enter image description here"></a></p>
  
  <p>My code is this:</p>
  
  <pre><code>mydata &lt;- read_excel("WDR2016Fig215.xls", col_names = TRUE) 
  
  y &lt;- mydata$value
  x &lt;- mydata$country
  z &lt;- mydata$Skill
  
  ggplot(data=mydata, aes(x=x, y=y, fill=z)) + 
              geom_bar(stat="identity", position=position_dodge(), colour="black") + 
              scale_x_discrete(limits=x) 
  </code></pre>
  
  <p>The graph is nicely sorted as I want but the x axis is for some reason expanded. Any idea what is the problem?</p>