title: ggplot: get discrete legend with scale_fill_gradient
body: <p>I'm trying to recreate an example figure from 'R Graphics Cookbook' p.87.</p>
  
  <p><a href="https://i.stack.imgur.com/Ajv5h.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ajv5h.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to recreate with the following code, but I don't get the result:</p>
  
  <pre><code>library(ggplot2)
  library(hexbin)
  
  sp &lt;- ggplot(diamonds, aes(x=carat, y=price))
  sp + stat_binhex() +
    scale_fill_gradient(low="lightblue", high="red",
                        breaks=c(0, 250, 500, 1000, 2000, 4000, 6000),
                        limits=c(0, 6000)) 
  </code></pre>
  
  <p>which gives </p>
  
  <p><a href="https://i.stack.imgur.com/8ct2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8ct2a.png" alt="enter image description here"></a></p>