title: Plotting a raster in R with specific colors for specific values
body: <p>I hava a raster with 10 values: </p>
  
  <p><code>vals &lt;- c(1,2,3,4,5,12,123,1234,12345,23,234,2345,34,345,45)</code></p>
  
  <p>I would like to produce a plot, where value 1 to 5 is coloured. And all other values are in grey scale. Plus, I'd like the legend to specifically show each value and the corresponding color. In ArcGIS this is easy to accomplish (see desired outcome)<a href="https://i.stack.imgur.com/X17yg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X17yg.png" alt="enter image description here"></a></p>
  
  <p>I tried a lot, but I could not come up with a solution to get a good result. Can anyone help? </p>
  
  <p>Raster can be found here: <a href="https://www.dropbox.com/s/kzcba9r4t9z4mc1/raster.tif?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/kzcba9r4t9z4mc1/raster.tif?dl=0</a></p>