title: Mapview legend scaling
body: <p>I am trying to create a map containing some negative values and mostly positive values. The code I have (given below) generates the correct map, however the legend is not centered at 0 (ie. the white color is not at 0, while more negative values are deeper red and more positive values are blue). How can I change the color palette to center around 0 regardless of the values in the dataset? </p>
  
  <p>Code:</p>
  
  <pre><code>library(tidyverse)
  library(sf)
  library(mapview)
  
  palfunc &lt;- function (n, alpha = 1, begin = 0, end = 1, direction = 1) 
  {
  colors &lt;- RColorBrewer::brewer.pal(11, "RdBu")
  if (direction &lt; 0) colors &lt;- rev(colors)
  colorRampPalette(colors, alpha = alpha)(n)
  }
  
  
  foo &lt;- franconia %&gt;% mutate(foo = rnorm(n()) + 2)
  
  max_val = max(abs(foo$foo), na.rm = T)
  n_val = max( length(unique(keep(foo$foo, ~.x &gt; 0))),
           length(unique(keep(foo$foo, ~.x &lt; 0))))
  at = lattice::do.breaks(endpoints = c(-max_val, max_val), nint = 2 * n_val + 1)
  p &lt;- mapView(foo, zcol = 'foo', layer.name = "Example", col.regions = palfunc, at = at)
  </code></pre>