tm_raster {tmap} | R Documentation |
Map layer: raster
Description
Map layer that draws rasters. Supported visual variable is: col
(the color).
Usage
tm_raster(
col = tm_vars(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_raster(),
...
)
opt_tm_raster(interpolate = FALSE)
Arguments
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
zindex |
Map layers are drawn on top of each other. The |
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: |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
interpolate |
Should the raster image be interpolated? Currently only applicable in view mode (passed on to |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments 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 (seetm_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 variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
Examples
## Not run:
# load land data
data(land, World)
tm_shape(land) +
tm_raster("cover")
tm_shape(land) +
tm_raster("elevation", col.scale = tm_scale_continuous(values = terrain.colors(9))) +
tm_shape(World) +
tm_borders()
## End(Not run)