title: R lattice colors with asymmetric color gradient
body: <p>I am using R <code>lattice()</code> to make a 3D wireframe plot.  The color scale for the surface ranges from -0.6 to +0.2.  I created a blue-white-red color gradient scheme with:</p>
  
  <pre><code>bwr.colors &lt;- colorRampPalette(c("blue, "white", "red"))
  </code></pre>
  
  <p>and am creating the plot like so:</p>
  
  <pre><code>gca_plot &lt;- wireframe(dev ~ col*row, data=gca, 
             xlab = "col",
             xlim = c(1, 24),
             ylab = "row",
             ylim = c(9, -6),
             zlim=c(-0.6, 0.2),
             main = "GCA",
             drape = TRUE,
             colorkey = TRUE,
             at=do.breaks(c(-0.6,0.2),100),
             scales = list(arrows=FALSE,cex=.5, tick.number = 10, z = list(arrows=F), distance =c(1.5, 1.5, 1.5)),
             col.regions = bwr.colors(100),
             screen = list(z = 30, x = -60))
  </code></pre>
  
  <p>The problem is that I'd like to center color (white) to be at zero since this is a deviation plot.  I want red values > 0 and blue &lt; 0.  </p>
  
  <p>I know that making my scale run from -0.6 to +0.6 would solve this, but that uses up a much-too-small portion of the z-axis.  I also know that the <code>scale_colour_gradient2()</code> function can achieve what I want (it allows you to set the midpoint value), but that's a <code>ggplot2()</code> function and I'm in <code>lattice()</code> since <code>ggplot2()</code> doesn't do 3-D surfaces like this (unless I missed something).</p>
  
  <p>Here's what my plot looks like.  It's crammed in the corner of the frame by design -- it's a 13x9 field that will be compared to a different plot containing a 24x16 field.</p>
  
  <p><a href="https://i.stack.imgur.com/SnBhc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SnBhc.jpg" alt="enter image description here"></a></p>