Map layer: rasterSource:
Map layer that draws rasters. Supported visual variable is:
col (the color).
tm_raster( col = tm_shape_vars(), col.scale = tm_scale(value.na = "#00000000"), col.legend = tm_legend(), col.free = NA, col_alpha = tm_const(), col_alpha.scale = tm_scale(), col_alpha.legend = tm_legend(), col_alpha.free = NA, trans.args = list(), mapping.args = list(), zindex = NA, group = NA, group.control = "check", ... )
- col, col.scale, col.legend, col.free
Visual variable that determines the color. See details.
- col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free
Visual variable that determines the alpha transparency. See details.
- trans.args, mapping.args
lists that are passed on to internal transformation and mapping functions respectively.
Map layers are drawn on top of each other. The
zindexnumbers (one for each map layer) determines the stacking order. By default the map layers are drawn in the order they are called.
Name of the group to which this layer belongs. This is only relevant in view mode, where layer groups can be switched (see
In view mode, the group control determines how layer groups can be switched on and off. Options:
"radio"for radio buttons (meaning only one group can be shown),
"check"for check boxes (so multiple groups can be shown), and
"none"for no control (the group cannot be (de)selected).
to catch deprecated arguments from version < 4.0
The visual variable arguments (e.g.
col) can be specified with either a data
variable name (of the object specified in
tm_shape()), or with a visual value
col, a color is expected). Multiple values can be specified: in that
case facets are created. These facets can be combined with other faceting data
variables, specified with
.scalearguments determine the used scale to map the data values to visual variable values. These can be specified with one of the available
tm_scale_()functions. The default scale that is used is specified by the tmap option
.legendarguments determine the used legend, specified with
tm_legend(). The default legend and its settings are determined by the tmap options
.freearguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (see
tm_facets()). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (
tm_facets_grid()). For instance,
col.free = c(TRUE, FALSE, FALSE)means that for the visual variable
col, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (
tm_facets_stack()), there is only one facet dimension, so the
.freeargument requires only one logical value.
# load land data data(land, World) tm_shape(land) + tm_raster() + tm_facets_hstack() #> stars object downsampled to 540 by 270 cells. #> Variable(s) "col" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette. #> Warning: Some legend items or map compoments do not fit well (e.g. due to the specified font size). #> Warning: Some legend items or map compoments do not fit well (e.g. due to the specified font size). #> Warning: Some legend items or map compoments do not fit well (e.g. due to the specified font size). #> Warning: Some legend items or map compoments do not fit well (e.g. due to the specified font size). tm_shape(land) + tm_raster("elevation", col.scale = tm_scale_continuous(values = terrain.colors(9))) + tm_shape(World) + tm_borders()