I have a data frame containing a number of (x,y,z)
data points, (x,y)
is the lower-right coordinate of a longitude-latitude cell of size w
(e.g. a 1-degree grid). The z
value has been averaged over this cell.
I'd like to plot these points in R so that the entire grid cell is filled with some colour derived from z
.
The result would look something like one of these images:
The projection itself (e.g. Lambert conformal conic, equirectangular) isn't important, just the grid cell plotting.
My data is sparse: not every longitude-latitude cell will have data associated with it.
My hope would be a solution similar to
library(maps)
map("state")
grid_points(my_data,c("x","y","z"),0.5)
where 0.5 is the grid resolution above, indicating a 0.5-degree cell.
Any thoughts?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…