# NOT RUN {
map_key <- 'your_api_key'
google_map(key = map_key, data = tram_stops) %>%
add_circles(lat = "stop_lat", lon = "stop_lon", fill_colour = "stop_name",
stroke_weight = 0.3, stroke_colour = "stop_name", info_window ="stop_id")
## different colour palettes
lstPalette <- list(fill_colour = colorRampPalette(c("red","blue")),
stroke_colour = viridisLite::plasma)
## set the key via set_key()
set_key(key = map_key)
google_map(data = tram_stops) %>%
add_circles(lat = "stop_lat", lon = "stop_lon", fill_colour = "stop_lat",
stroke_weight = 2, stroke_colour = "stop_name", palette = lstPalette, legend = T)
## controlling the legend
google_map(data = tram_stops) %>%
add_circles(lat = "stop_lat", lon = "stop_lon", fill_colour = "stop_lat",
stroke_weight = 2, stroke_colour = "stop_name",
legend = c(fill_colour = T, stroke_colour = F),
legend_options = list(position = "TOP_RIGHT", css = "max-height: 100px;"))
google_map(data = tram_stops) %>%
add_circles(lat = "stop_lat", lon = "stop_lon", fill_colour = "stop_lat",
stroke_weight = 2, stroke_colour = "stop_name",
legend = T,
legend_options = list(
fill_colour = list(position = "TOP_RIGHT", css = "max-height: 100px;"),
stroke_colour = list(position = "LEFT_BOTTOM", title = "Stop Name")
))
# }
Run the code above in your browser using DataLab