title: Adjust color scale of image plot in R
body: <p>The <code>image.plot</code> function automatically generate the color scale for the inputs. For example,</p>
  
  <pre><code>library(fields)
  x &lt;- 1:10
  y &lt;- 1:15
  z &lt;- outer(x, y, "+")
  image.plot(x, y, z)
  </code></pre>
  
  <p>will generate a figure like this
  <a href="https://i.stack.imgur.com/xBWeO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xBWeO.png" alt="enter image description here"></a>
  Now I want to adjust the color scale to the range from 0 to 20, and any values above 20 need to be colored the same as 20. So I added <code>zlim=c(0,20)</code> in the function parameters, and I get,
  <a href="https://i.stack.imgur.com/GDJ2z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDJ2z.png" alt="enter image description here"></a>
  The problem is, although <code>zlim</code> adjusted the color scale range, the values above the limit were not assigned a color. How can I fix this? In this case, I want the up-right corner to be colored dark red i.e. to have the color assigned from the end of the color range.</p>