title: R Plot Filled Longitude-Latitude Grid Cells on Map
body: <p>I have a data frame containing a number of <code>(x,y,z)</code> data points, <code>(x,y)</code> is the lower-right coordinate of a longitude-latitude cell of size <code>w</code> (e.g. a 1-degree grid). The <code>z</code> value has been averaged over this cell.</p>
  
  <p>I'd like to plot these points in R so that the entire grid cell is filled with some colour derived from <code>z</code>.</p>
  
  <p>The result would look something like one of these images:
  <img src="https://i.stack.imgur.com/ygDyf.jpg" alt="longitude-latitude grid cells filled"></p>
  
  <p>The projection itself (e.g. Lambert conformal conic, equirectangular) isn't important, just the grid cell plotting.</p>
  
  <p>My data is sparse: not every longitude-latitude cell will have data associated with it.</p>
  
  <p>My hope would be a solution similar to</p>
  
  <pre><code>library(maps)
  map("state")
  grid_points(my_data,c("x","y","z"),0.5)
  </code></pre>
  
  <p>where 0.5 is the grid resolution above, indicating a 0.5-degree cell.</p>
  
  <p>Any thoughts?</p>
  
  <p>Thanks!</p>