title: ggplot split bars by percentage
body: <p>I have a tibble...</p>
  <pre><code># A tibble: 9 x 4
    Variable Correlation Type  Percentage
    &lt;fct&gt;          &lt;dbl&gt; &lt;fct&gt;      &lt;dbl&gt;
  1 Bar1            0.16 A            0.7
  2 Bar1            0.16 B           NA  
  3 Bar1            0.16 C            0.3
  4 Bar2            0.17 A            0.1
  5 Bar2            0.17 B           NA  
  6 Bar2            0.17 C            0.9
  7 Bar3            0.17 A            0.1
  8 Bar3            0.17 B            0.6
  9 Bar3            0.17 C            0.3
  </code></pre>
  <p>I want a barplot with Variable on the x-axis and the correlation on the y-axis.</p>
  <p>It should only have 3 bars for the x-axis (Bar1, Bar2, Bar3) with y-axis values of .16, .17, .17.</p>
  <p>I want to split the 3 bars by Type into A, B and C percentages. For example, Bar1 would be 70% A and 30% C.</p>
  <p>So far I have the following...</p>
  <pre><code>dat %&gt;% 
    ggplot(., aes(x = Variable, y = Correlation/3, fill = Type)) +
    geom_col(stat = &quot;identity&quot;)
  </code></pre>
  <p>But this just splits the bars evenly into A, B and C. I can't work out how to incorporate the percentages as well.</p>
  <p><a href="https://i.stack.imgur.com/ulhKr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ulhKr.png" alt="Plot attempt" /></a></p>