What's next in googleway: legends
Due: version 2.4
In a previous post I introduced colours to googleway
. That's amazing, I hear you say! What's even more amazing is that now you can see what those colours represent through legends.
## until v2.4 is released you'll need the development version
devtools::install_github("SymbolixAU/googleway")
library(googleway)
mapKey <- 'your_api_key'
## using the default legend
google_map(key = mapKey) %>%
add_polygons(data = melbourne, polyline = "polyline",
fill_colour = "SA4_NAME", fill_opacity = 0.8,
stroke_colour = "SA4_NAME", legend = T)
And you can specify various options through the legend_options
argument.
## currently available options: position, css, title, reverse, prefix and suffix
legendOptions <- list(
position = "RIGHT_TOP",
css = "max-width: 200px; max-height: 300px",
title = "Statistical Area 4"
)
google_map(key = mapKey) %>%
add_polygons(data = melbourne, polyline = "polyline",
fill_colour = "SA4_NAME", fill_opacity = 0.8,
stroke_colour = "SA4_NAME", legend = T,
legend_options = legendOptions)