Position geom_text in the middle of each bar segment in a geom_col stacked barchart : <p><strong>I would like to position the corresponding value labels in a <code>geom_col</code> stacked barchart in the middle of each bar segment</strong>. </p>

<p>However, my naive attempt fails.</p>

<pre><code>library(ggplot2) # Version: ggplot2 2.2

dta &lt;- data.frame(group  = c("A","A","A",
                             "B","B","B"),
                  sector = c("x","y","z",
                             "x","y","z"),
                  value  = c(10,20,70,
                             30,20,50))

ggplot(data = dta) +
  geom_col(aes(x = group, y = value, fill = sector)) +
  geom_text(position="stack",
            aes(x = group, y = value, label = value)) 
</code></pre>

<p><a href="https://i.stack.imgur.com/Bnt3O.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Bnt3O.jpg" alt=""></a></p>

<p>Obviously, setting <code>y=value/2</code> for <code>geom_text</code> does not help, either. Besides, the text is positioned in the wrong order (reversed).</p>

<p>Any (elegant) ideas how to solve this?</p>
