if (FALSE) {
map_key <- 'your_api_key'
set.seed(20170417)
df <- tram_route
df$weight <- sample(1:10, size = nrow(df), replace = T)
google_map(key = map_key, data = df) %>%
add_heatmap(lat = "shape_pt_lat", lon = "shape_pt_lon", weight = "weight",
option_radius = 0.001, legend = T)
## specifying different colour gradient
option_gradient <- c('orange', 'blue', 'mediumpurple4', 'snow4', 'thistle1')
google_map(key = map_key, data = df) %>%
add_heatmap(lat = "shape_pt_lat", lon = "shape_pt_lon", weight = "weight",
option_radius = 0.001, option_gradient = option_gradient, legend = T)
}
Run the code above in your browser using DataLab