Description Usage Arguments Value Examples
Add a tooltip on a map
1 2 | add_tooltip(map, value = "<b>{name}</b><<scale_var>>", as_glue = TRUE,
.na = "no data")
|
map |
A |
value |
A |
as_glue |
Use a |
.na |
Value to replace NA values with (if |
A r2d3map
htmlwidget
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library( r2d3maps )
library( rnaturalearth )
belgium <- ne_states(country = "belgium", returnclass = "sf")
# default
d3_map(shape = belgium) %>%
add_tooltip()
# glue
d3_map(shape = belgium) %>%
add_tooltip(value = "{name} ({gn_name})")
# formula
d3_map(shape = belgium) %>%
add_tooltip(value = ~paste0(name, " (", gn_name, ")"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.