问题描述
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,)
我们做了一个度量运动,所以我有4460个地理指向点。
为了制作预测图,我创建了一个网格400 * 400,总计160000个点,其中我使用克里金来计算预测。
要在我的3公里* 3公里范围内全面了解这种现象,我认为某种热图是必要的,因为只绘制点,如果我不是
做任何错误,地图。 (请参阅)
我用来绘制点的代码是:
turkumap< - turkumap + geom_point(data = temp,aes(x = lon,y = lat),size = var1.pred)
所以基本上问题是点是沿着道路的,所以一个热图是有问题的
(请参阅),并且有太多可以单独绘制它们。
有什么建议吗?
另一个相关的问题是我的数据是gstat,SpatialPointsDataFrame的经典格式,这意味着我必须强制它们是dataframes使用
ggplot,有没有更好的做法?
@SlowLearner提供的链接解决了我的问题
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 notdoing 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 useggplot, is there a better practice?
The link provided by @SlowLearner solved my issue
这篇关于来自克里金数据的ggmap热图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!