title: R center color palette on 0
body: <p>I would like to create a color ramp centered on 0.</p>
  
  <p>The following code:</p>
  
  <pre><code>library(raster)
  librayr(RColorBrewer)
  
  xmin = -124.413
  xmax = -66.883
  ymin = 25.9425
  ymax = 48.9885
  nrows = 215
  ncols = 254
  
  empty_raster = raster(xmn=xmin, ymn=ymin, nrows = nrows, ncols = ncols)
  zscores_coords = cbind(seq(from=-124.413, to=-66.883, length.out=1212), 
                         seq(from=25.9425, to=48.9885, length.out=1212))
  zscores_raster = rasterize(zscores_coords, empty_raster, field = 1)
  x_coord_raster = rasterize(zscores_coords, zscores_raster, 
                             field=zscores_coords[,1])
  y_coord_raster = rasterize(zscores_coords, zscores_raster, 
                             field=zscores_coords[,2])
  
  BUD_zscores_coordinates = 
    data.frame(x = zscores_coords[,1], y = zscores_coords[,2], 
               BUD_zscores = seq(from=-20.51558, to=14.34510, length.out=1212))
  coordinates(BUD_zscores_coordinates) = ~x+y
  zscores_pres = rasterize(BUD_zscores_coordinates, zscores_raster, field=1)
  zscores_points = rasterToPoints(zscores_pres)
  zscores_points = zscores_points[,c(1:2)]
  
  zscores_nodes = rasterize(BUD_zscores_coordinates, empty_raster, 
                            field = BUD_zscores_coordinates$BUD_zscores,
                            fun = mean)
  
  #Plot! 
  colorramp = brewer.pal(11,"RdBu")
  applycolors = colorRampPalette(colorramp)
  plot(zscores_nodes, xlim = c(xmin, xmax), ylim = c(ymin, ymax), 
       col = applycolors(100))
  </code></pre>
  
  <p>Produces the following graphic:</p>
  
  <p><img src="https://i.stack.imgur.com/Wobbb.jpg" alt="Color ramp example"></p>
  
  <p>In which '0' is in the light blue section of the color ramp. Any advice on how to make it align with the white section? I've struggled with using breaks to no avail.</p>