r heatmap on ggmap from kriging data
Asked Answered
C

1

1

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?

Chichihaerh answered 19/9, 2013 at 10:12 Comment(2)
In response to this question somebody posted a fully worked example of how to bin your data and plot it in ggmap with the colour scales of your choice over a map. You may well find some ideas there. And if you're using ggplot you do need a data frame, so you pretty much have to use fortify.Amur
Thank you! I spent so much time searching before posting, but I did not see that entry.Chichihaerh
C
0

The link provided by @SlowLearner solved my issue

Chichihaerh answered 19/10, 2014 at 7:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.