title: Control middle value colours with scale_colour_continuous using R/ggplot2
body: <p>I have a set of data and would like to map the <code>colour</code> aesthetic around a sort of "reference value" like so:</p>
  
  <ul>
  <li>values below are red</li>
  <li>values near are blue</li>
  <li>values above are green</li>
  </ul>
  
  <p>I still want to show the fact that values are on a continuoum, so simply using a function like <code>cut()</code> and using <code>scale_colour_discrete</code> is  not what I'm looking for. Here's some example data:</p>
  
  <pre><code>set.seed(123)
  x &lt;- runif(100, min = 1, max = 10)
  y &lt;- runif(100, min = 1, max = 10)
  test &lt;- data.frame(x = x, y = y)
  test$colour &lt;- runif(100, min = 1, max = 10)
  ggplot(test, aes(x = x, y = y, colour = colour)) + geom_point(size = 3)
  </code></pre>
  
  <p>That produces the following:</p>
  
  <p><img src="https://i.stack.imgur.com/Xd058.png" alt="enter image description here"></p>
  
  <p>I'm familiar with <code>scale_colour_gradient(low = "red", high = "green")</code>, however I was hoping to more deliberately transition my colours along desired value mapping to make the regions "pop" a bit more visually. Spacing would not necessarily be linear. in other words, for a reference value of 3, the mapping would be something like this:</p>
  
  <pre><code>value:  1     3      10
  colour: red   blue   green
  </code></pre>
  
  <p>Is this possible? I'd also take alternative solutions to accomplish a good visualization to highlight "desirable" values easily among a sea of points. For example, I considered replacing values near the reference such that <code>(ref - tol &lt; colour &lt; ref + tol) &lt;- NA</code>, and then using <code>scale_colour_gradient</code>'s option for <code>na.value</code>.</p>
  
  <p>Or should I truly be considering the <code>cut()</code> option, just with a very small cut size and then figure out how to gradually change the colours along the resultant breaks?</p>