我正在使用创建热图googleway
。例如,对于帮助中给出的 tram_route 示例?add_heatmap
,如何添加色标以便读者知道与该颜色相关的数字是多少?
谢谢你。
截至 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)