I am wondering how I can draw an image of the population proportion (pop.prop) at these locations (x and y) so that I can see the population distribution clearly?
The data is shown below:
pts.pr = pts.cent[pts.cent$PIDS==3, ]
pop = rnorm(nrow(pts.pr), 0, 1)
pop.prop = exp(pop)/sum(exp(pop))
pts.pr.data = as.data.frame(cbind(pts.pr@coords, cbind(pop.prop)))
x y pop.prop
3633 106.3077 38.90931 0.070022855
3634 106.8077 38.90931 0.012173106
3756 106.3077 38.40931 0.039693085
3878 105.8077 37.90931 0.034190747
3879 106.3077 37.90931 0.057981214
3880 106.8077 37.90931 0.089484103
3881 107.3077 37.90931 0.026018622
3999 104.8077 37.40931 0.008762790
4000 105.3077 37.40931 0.030027889
4001 105.8077 37.40931 0.038175671
4002 106.3077 37.40931 0.017137084
4003 106.8077 37.40931 0.038560394
4123 105.3077 36.90931 0.021653256
4124 105.8077 36.90931 0.107731536
4125 106.3077 36.90931 0.036780336
4247 105.8077 36.40931 0.269878770
4248 106.3077 36.40931 0.004316260
4370 105.8077 35.90931 0.003061392
4371 106.3077 35.90931 0.050781007
4372 106.8077 35.90931 0.034190670
4494 106.3077 35.40931 0.009379213
x
is the longitude and y
is the latitude.
I think I've found three potential solutions/approaches.
First the data:
The first approach is similar to the one I mentioned in the comments above, except using symbol colour instead of symbol size to indicate population size:
The second approach relies on converting the lon-lat-value format into a regular raster which can then be represented as a heat map:
Lifted from here: How to make RASTER from irregular point data without interpolation
Also worth checking out: creating a surface from "pre-gridded" points. (Uses
reshape2
instead ofraster
)The third approach relies on interpolation to draw filled contours:
Nabbed from here: Plotting contours on an irregular grid