title: ggplot2 stats="identity" and stacking colors in bar plot gives "striped" bar chart
body: <p>Following the answer to my <a href="https://stackoverflow.com/questions/17790721/plotting-the-sum-of-values-in-one-column-a-depending-on-data-in-another-column">former question</a> I have another question raising :</p>
  
  <p>How, without reshaping the data, to plot a stacked bar plot with different colour depending on another category, at the same time using stats="identity" to sum up values for each stacked area ?</p>
  
  <p>The stats identity works nicely to sum up the values, but for non-stacked columns. In a stacked column, the stacking is somehow "multiplied" or "striped", see picture below.</p>
  
  <p>Some data sample :</p>
  
  <pre><code>element &lt;- rep("apples", 15)
  qty &lt;- c(2, 1, 4, 3, 6, 2, 1, 4, 3, 6, 2, 1, 4, 3, 6)
  category1 &lt;- c("Red", "Green", "Red", "Green", "Yellow")
  category2 &lt;- c("small","big","big","small","small")
  d &lt;- data.frame(element=element, qty=qty, category1=category1, category2=category2)
  </code></pre>
  
  <p>Which gives that table :</p>
  
  <pre><code>id  element  qty category1 category2
  1   apples   2       Red     small
  2   apples   1     Green       big
  3   apples   4       Red       big
  4   apples   3     Green     small
  5   apples   6    Yellow     small
  6   apples   2       Red     small
  7   apples   1     Green       big
  8   apples   4       Red       big
  9   apples   3     Green     small
  10  apples   6    Yellow     small
  11  apples   2       Red     small
  12  apples   1     Green       big
  13  apples   4       Red       big
  14  apples   3     Green     small
  15  apples   6    Yellow     small
  </code></pre>
  
  <p>Then :<br>
      ggplot(d, aes(x=category1, y=qty, fill=category2)) + geom_bar(stat="identity")</p>
  
  <p>But the graph is a bit messy: the colors aren't grouped together !</p>
  
  <p><img src="https://i.stack.imgur.com/AMfwm.png" alt="ggplot graph is striped"> 
  Why is there this behaviour? </p>
  
  <p>Is there still an option to correctly group the colors without reshaping my data ? </p>