How to specify colors in plotting image in R
<p>I want to make an image plot with values from -40 to 100. The image with default coloring them is given below. Since the values are not symmetric, zero has light blue color.</p>

<p>I want to set zero value as white. Positive values should have warm colors with maximum value as dark red. Negative values should have cool colors with dark blue for the most negative values.</p>

<p>Thanks.</p>

<pre><code>library(fields)
x &lt;- 1:100
y &lt;- 1:200
set.seed(1)
z &lt;- runif(20000, -40, 100)
z &lt;- matrix(z, 100, 200)
surface &lt;- list(x=x, y=y, z=z)
plot.surface(surface, type = "I", xlab = "x", ylab = "y")
</code></pre>

<p><a href="https://i.stack.imgur.com/WL2mm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WL2mm.png" alt="enter image description here"></a></p>