title: How to position your labels in stacked bar graph plot in ggplot where the y axis is "count"?
body: <h1>plotting the ggplot with x axis as names(categorical) and y axis came default as count</h1>
  <pre><code>gnew = ggplot(data= got, aes(x= got$attacker_king, fill= got$attacker_outcome))+
      geom_bar() +
      geom_text(stat = &quot;count&quot;, aes(label =..count..), vjust = -.5)+
      scale_y_continuous(limits = c(0,20)) # plotting the stacked ggplot #this works
  </code></pre>
  <h1>Trying to position the labels according to the position of the fills</h1>
  <pre><code>got = ddply(got, .(got$attacker_king), 
      transform, pos = cumsum(..count..)- (0.5 *..count..)) # positioning labels shows error
  
  #This shows error as &quot;Error in eval(expr, envir, enclos) : object '..count..' not found&quot;
  
  Please help!
  </code></pre>
  <h1>this is what i have with ggplot</h1>
  <p>(they are not in their right positions. positions need to be swapped and centered)
  <a href="https://i.stack.imgur.com/IrFwh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IrFwh.jpg" alt="enter image description here" /></a></p>