I\'m new to R. i want to generate a heat map using PHP, MongoDB and R. i want to plot geo coordinates(Lat, Lng) on World Map. Below is the sample code i\'m trying to use. pl
ggmap(mapgilbert) +
stat_density2d(data = df, aes(x = lon, y = lat, fill = ..level..,
alpha = ..level..), size = 0.01,
bins = 16, geom = "polygon") +
scale_fill_gradient(low = "green", high = "red") +
scale_alpha(range = c(0, 0.3), guide = FALSE)
I think 4 million points are too computationally expensive. Maybe you should use a subset or sample from your data.