title: R: ggplot stacked bar chart with counts on y axis but percentage as label
body: <p>I'm looking for a way to label a stacked bar chart with percentages while the y-axis shows the original count (using ggplot). Here is a MWE for the plot without labels:</p>
  
  <pre><code>library(ggplot2)
  df &lt;- as.data.frame(matrix(nrow = 7, ncol= 3,
                         data = c("ID1", "ID2", "ID3", "ID4", "ID5", "ID6", "ID7",
                                  "north", "north", "north", "north", "south", "south", "south",
                                  "A", "B", "B", "C", "A", "A", "C"),
                        byrow = FALSE))
  
  colnames(df) &lt;- c("ID", "region", "species")
  
  p &lt;- ggplot(df, aes(x = region, fill = species))
  p  + geom_bar()
  </code></pre>
  
  <p>I have a much larger table and R counts quite nicely the different species for every region. Now, I would like to show both, the original count value (preferably on the y-axis) and the percentage (as label) to compare proportions of species between regions.</p>
  
  <p>I tried out many things using <code>geom_text()</code> but I think the main difference to other questions (<a href="https://stackoverflow.com/questions/12386005/r-stacked-percentage-bar-plot-with-percentage-of-binary-factor-and-labels-with">e.g. this one</a>) is that </p>
  
  <ul>
  <li>I do not have a separate column for y values (they are just the counts of different species per region) and </li>
  <li>I need the labels per region to sum up to 100% (since they are considered to represent seperate populations), not all labels of the entire plot.</li>
  </ul>
  
  <p>Any help is much appreciated!!</p>