r heatmap on ggmap from kriging data

安稳与你 提交于 2019-12-06 12:29:05

问题


I want to plot a heatmap on a ggmap.

  library(ggmap)
  turku<-get_map('turku', zoom=13)
  turkumap<-ggmap(turku, extent="device", legend="topleft")
  turkumap
  turkumap+geom_density2d(mapping=aes(x = lon, y = lat),data = test, )

We have made a measurement campaign, so I have 4460 geo-referentiated points.

To have a prediction map, I created a grid 400*400, for a total of 160000 points in which I calculate the prediction with kriging. To have a full picture of the phenomenon in my 3 km *3 km i think some kind of heat map is necassary because plotting only the points, if I am not doing anything wrong plots a filled square on the map. (See file) The code I use to plot the points is:

turkumap <- turkumap + geom_point(data=temp, aes(x=lon, y=lat),size=var1.pred)

So basically the problem is that the points are along roads, so a heat map is problematic (see here) and there are too many to plot them singularly. Any suggestions?

The other related question is that my data are in the classical format of gstat, SpatialPointsDataFrame, this means that I have to coerce them to be dataframes to use ggplot, is there a better practice?


回答1:


The link provided by @SlowLearner solved my issue



来源:https://stackoverflow.com/questions/18891922/r-heatmap-on-ggmap-from-kriging-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!