title: Creating a log axis in a 100% stacked column chart in R with ggplot
body: <p>I have data in percentages. I would like to use ggplot to create a graph, but I cannot get it to work like I would like.  Since the data is very skewed a simple stacked column doesn't work well because the really small values don't show up.  Here is a sample set:</p>
  
  <pre><code>    Actual  Predicted
  a   0.5     5
  b   9.5     5
  c   90      90
  </code></pre>
  
  <p>On the left is an excel plot and on the right is R-ggplot</p>
  
  <p><img src="https://i.stack.imgur.com/4JWXU.png" alt="Excel"><img src="https://i.stack.imgur.com/Z1n9I.png" alt="Rplot"></p>
  
  <p>The problem is that in R the columns do not stack up to be even.</p>
  
  <p>Here is my R code:</p>
  
  <pre><code>a = c("a","b","c","a","b","c")
  b = c("Actual","Actual","Actual","Predicted","Predicted","Predicted")
  c = c(0.5,2.5,97,0.2,2.2,97.6)
  c = c+1
  
  dat = data.frame(Type=a, Case=b, Percentage=c)
  ggplot(dat, aes(x=Case, y=Percentage, fill=Type)) + geom_bar(stat="identity") + scale_y_log10()
  </code></pre>
  
  <p>*In both Excel and R I do a +1 to deal with numbers 0-1, so the y-axis is off slightly</p>
  
  <p>If I use:</p>
  
  <pre><code>ggplot(dat, aes(x=Case, y=Percentage, fill=Type)) + geom_bar(stat="identity",position = "fill") + scale_y_log10()
  </code></pre>
  
  <p>The total heights match, however the two blue portions do not match in size (they are both 90%)</p>
  
  <p><img src="https://i.stack.imgur.com/MxKO2.png" alt="enter image description here"></p>