View source: R/tm_add_legend.R
tm_add_legend | R Documentation |
Map component that adds a manual legend.
tm_add_legend(
...,
labels = "",
type = "symbols",
title = "",
design = NULL,
orientation = NULL,
position = NULL,
group_id = NA_character_,
group = NA,
group.control = "check",
z = NA_integer_
)
... |
visual variables and arguments passed on to |
labels |
labels by default |
type |
the layer type from which the visual variables (see |
title |
The title of the legend. |
design |
The design of the legend. |
orientation |
The orientation of the legend. |
position |
The position of the legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how
layer groups can be switched on and off. Options: |
z |
z index, e.g. the place of the component relative to the other componets |
## Not run:
tm_shape(NLD_muni) +
tm_borders() +
tm_basemap("OpenStreetMap") +
tm_add_legend(labels = c("Motorway", "Primary road", "Secondary road", "Railway"),
col = c("#E892A1", "#FCD6A4", "#F8FABF", "#707070"),
lty = c("solid", "solid", "solid", "dotted"),
lwd = 3,
type = "lines",
bg.color = "grey92",
bg.alpha = 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.