tm_legend | R Documentation |
Legend specification
tm_legend(
title,
show,
orientation,
design,
reverse,
na.show,
position,
width,
height,
stack,
z,
group.frame,
resize_as_group,
title.color,
title.size,
title.fontface,
title.fontfamily,
title.alpha,
title.padding,
title.align,
text.color,
text.size,
text.fontface,
text.fontfamily,
text.alpha,
format,
frame,
frame.lwd,
frame.r,
bg.color,
bg.alpha,
absolute_fontsize,
item.height,
item.width,
item.space,
item.na.height,
item.na.width,
item.na.space,
item.shape,
ticks,
ticks.disable.na,
ticks.col,
ticks.lwd,
margins,
item_text.margin,
...
)
tm_legend_hide()
tm_legend_combine(variable)
tm_legend_bivariate(
xlab,
ylab,
xlab.color,
xlab.size,
xlab.fontface,
xlab.fontfamily,
xlab.alpha,
xlab.padding,
xlab.align,
ylab.color,
ylab.size,
ylab.fontface,
ylab.fontfamily,
ylab.alpha,
ylab.padding,
ylab.align,
...
)
title |
Legend title |
show |
Show legend? |
orientation |
Orientation of the legend: |
design |
Legend design |
reverse |
Should the legend be reversed? |
na.show |
Show |
position |
An object created with |
width |
Width of the legend. Units are 'text line heights'. In case a negative number is specified, the units are (approximate) pixels. The relation between these two is configured via the option |
height |
Height of the legend. Units are 'text line heights'. In case a negative number is specified, the units are (approximate) pixels. The relation between these two is configured via the option |
stack |
stack with other map components, either |
z |
z |
group.frame |
group.frame |
resize_as_group |
resize_as_group |
title.color |
The color of the title of the legend. |
title.size |
The size of the title of the legend. |
title.fontface |
The font face of the title of the legend. See |
title.fontfamily |
The font family of the title of the legend. See |
title.alpha |
The alpha transparency of the title of the legend. |
title.padding |
The padding of the title of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
title.align |
The align of the title of the legend. |
text.color |
The color of the text of the legend. |
text.size |
The size of the text of the legend. |
text.fontface |
The font face of the text of the legend. See |
text.fontfamily |
The font family of the text of the legend. See |
text.alpha |
The alpha transparency of the text of the legend. |
format |
Not used anymore: use the format argument of the |
frame |
frame |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg.color |
The color of the bg of the legend. |
bg.alpha |
The alpha transparency of the bg of the legend. |
absolute_fontsize |
The absolute fontsize of the legend. So far, only used to calculate legend dimensions |
item.height |
The height of the item of the legend. |
item.width |
The width of the item of the legend. |
item.space |
The space of the item of the legend. In terms of number of text line heights. |
item.na.height |
The height of the na item of the legend. |
item.na.width |
The width of the na item of the legend. |
item.na.space |
The space of the na item of the legend. In terms of number of text line heights. |
item.shape |
The shape of the item of the legend. |
ticks |
List of vectors of size 2 that determines the horizontal tick mark lines (for portrait legends). The values are the y-values of begin and endpoint of each tick mark. |
ticks.disable.na |
Remove ticks for |
ticks.col |
The color of the ticks of the legend. |
ticks.lwd |
The line width of the ticks of the legend. See |
margins |
The margins of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
item_text.margin |
The margin of the space between item and text of the legend. |
... |
visual values, e.g. |
variable |
visual (or transformation) variable to combine the legend with: e.g. |
xlab |
label for the x dimension (rows) |
ylab |
label for the y dimension (columns) |
xlab.color |
The color of the xlab of the legend. |
xlab.size |
The size of the xlab of the legend. |
xlab.fontface |
The font face of the xlab of the legend. See |
xlab.fontfamily |
The font family of the xlab of the legend. See |
xlab.alpha |
The alpha transparency of the xlab of the legend. |
xlab.padding |
The padding of the xlab of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
xlab.align |
The align of the xlab of the legend. |
ylab.color |
The color of the ylab of the legend. |
ylab.size |
The size of the ylab of the legend. |
ylab.fontface |
The font face of the ylab of the legend. See |
ylab.fontfamily |
The font family of the ylab of the legend. See |
ylab.alpha |
The alpha transparency of the ylab of the legend. |
ylab.padding |
The padding of the ylab of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
ylab.align |
The align of the ylab of the legend. |
A tm_legend component
# Example using different settings from tm_legend()
tm_shape(World) +
tm_polygons(
fill = "HPI",
fill.legend = tm_legend(
title = "Home Price Index",
design = "standard",
title.color = "orange",
bg.color = "purple",
show = TRUE
),
id = "name",
# Format the labels using dollar sign
fill.scale = tm_scale_intervals(
label.format = function(x) format(x, big.mark = " ")),
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.