Starting with a toy example I can quickly get an interactive map in tmap with the following code:
library(tmap)
tmap_mode("view")
data("World", "metro")
tm_shape(World) +
tm_polygons() +
tm_shape(metro) +
tm_dots("pop2010",
col = "red") +
tm_format("World")
I'd like the map to initially display only the World layer and have the metro layer hidden. It'd only appear when user ticks the box in the layers selection.
I went through tm_shape and tm_dots docs and haven't found anything that seems to control such behaviour. Is that possible?