title: Is there a built-in way to do a logarithmic color scale in ggplot2?
body: <p>Here's an example of a binned density plot:</p>
  <pre><code>library(ggplot2)
  n &lt;- 1e5
  df &lt;- data.frame(x = rexp(n), y = rexp(n))
  p &lt;- ggplot(df, aes(x = x, y = y)) + stat_binhex()
  print(p)
  </code></pre>
  <p><img src="https://i.stack.imgur.com/Ojpg8.png" alt="enter image description here" /></p>
  <p>It would be nice to adjust the color scale so that the breaks are log-spaced, but a try</p>
  <pre><code>my_breaks &lt;- round_any(exp(seq(log(10), log(5000), length = 5)), 10)
  p + scale_fill_hue(breaks = as.factor(my_breaks), labels = as.character(my_breaks))
  </code></pre>
  <p>Results in an <code>Error: Continuous variable () supplied to discrete scale_hue.</code> It seems breaks is expecting a factor (maybe?) and designed with categorical variables in mind?</p>
  <p>There's a not built-in work-around I'll post as an answer, but I think I might just be lost in my use of <code>scale_fill_hue</code>, and I'd like to know if there's anything obvious I'm missing.</p>