Layer groups
Via the group
and group.control
argument in
the map layer functions it is possible group layers and (de)select in
the leaflet layer control box.
tmap_mode("view")
#> ℹ tmap mode set to "view".
tm_shape(NLD_dist) +
tm_polygons(
fill = "dwelling_value",
col = NULL,
fill.scale = tm_scale_intervals(values = "-brewer.rd_yl_bu", breaks = c(75, 150, 250, 500, 750, 1000, 1600)),
fill.legend = tm_legend("Dwelling value (x 1000)"),
group = "District data") +
tm_shape(NLD_muni) +
tm_borders(lwd = 1, col = "black", group = "Municipality borders") +
tm_title("Select and deselect groups") +
tm_shape(NLD_prov, name = "Province borders") +
tm_borders(lwd = 3) +
tm_view(set_zoom_limits = c(8,14))
#> Registered S3 method overwritten by 'jsonify':
#> method from
#> print.json jsonlite