我正在使用googleway
创建热图。例如,对于?add_heatmap
帮助中给出的tram_route示例,如何添加色标以便读者知道与该颜色相关的数字是什么?
谢谢。
答案 0 :(得分:0)
截至2017年10月4日,该传奇仍处于开发阶段,可能会有所变化,可能尚未100%全面运作。
devtools::install_github("SymbolixAU/googleway")
library(googleway)
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)