title: How to label raster values in plot?
body: <p>How could I add pixel values to the plot? I can get the values by using <code>click()</code> but I want it to appear in the plot.</p>
  
  <pre><code>library(raster)
  r &lt;- raster(nrow=3, ncol=3)
  r[] &lt;- 1:ncell(r)
  plot(r)
  click(r) 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/HS8PS.jpg" alt="enter image description here"></p>