title: R how to control spacing of colour bar/legend
body: <p>I'd like to plot a map of chlorophyll concentration, but the values are dispersed in such a way that the legend becomes unreadable (see picture)</p>
  
  <p><img src="https://i.stack.imgur.com/r7tLV.png" alt="chl_a"></p>
  
  <p>So I am trying to control the spacing of the colours in the colour bar/legend. I'd like to get it evenly spaced (while keeping the uneven breaks on the map itself).</p>
  
  <p>The the example below is much simplified and is for a raster plot, but the same goes for image.plot.</p>
  
  <pre><code>library(raster)    
  r &lt;- raster(ncol=5, nrow=4)
  r[] &lt;- 1:20
  plot(r, breaks = c(0,1,2,3,5,10,20), col = rainbow(6))
  </code></pre>
  
  <p>I thought about converting the data to log values, but that doesn't give me a satisfying result. So any help with the legend is much appreciated.</p>