title: 1 bar in wrong order in stacked bar chart (R ggplot2)
body: <p>I made a stacked bar chart, however the segments of the 3rd bar are in a different order; the segment that should be on the bottom is now on the top, see image:</p>
  
  <p><img src="https://i.stack.imgur.com/8vKLN.png" alt="stacked bar chart"></p>
  
  <p>When I change the order of the x axis, it does exactly the same with the 3rd bar. How can I solve this? Something wrong with the code?</p>
  
  <pre><code>library('ggplot2')
  bar &lt;- ggplot(data.location, aes(Location, value, fill=variable))
  bar + stat_summary(fun.y=mean, geom="bar", position="stack")+labs(x="Location", y="value", fill="variable")
  </code></pre>
  
  <p>Added: output from dput(data.location)</p>
  
  <pre><code>dput(data.location[data.location$Location %in% c('BRM', 'CG', 'DDO'),])
  
  structure(list(Location = structure(c(2L, 3L, 5L, 2L, 3L, 5L, 
  2L, 3L, 5L, 2L, 3L, 5L), .Label = c("BA", "BRM", "CG", "CH", 
  "DDO", "DR", "FB", "GG", "GI", "GQS", "HC", "HS", "LL1", "LL2", 
  "MOW", "PP", "TP", "TR", "TRD", "WB"), class = "factor"), Zone = c(1L, 
  1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), variable = structure(c(1L, 
  1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("A", "B", "C", "D"
  ), class = "factor"), value = c(425.810194245673, 815.265455416096, 
  735.274721619422, 997.041922511793, 2147.03610300279, 1210.08829970945, 
  0, 177.692085889937, 173.266014794846, 406.498315338813, 1293.35105648741, 
  234.022025228589)), .Names = c("Location", "Zone", "variable", 
  "value"), row.names = c(2L, 3L, 5L, 22L, 23L, 25L, 42L, 43L, 
  45L, 62L, 63L, 65L), class = "data.frame")​
  </code></pre>