Draw a thematic map quickly.
qtm(shp, fill = NA, symbols.size = NULL, symbols.col = NULL,
symbols.shape = NULL, dots.col = NULL, text = NULL, text.size = 1,
text.col = NA, lines.lwd = NULL, lines.col = NULL, raster = NA,
borders = NA, by = NULL, scale = NA, title = NA, projection = NULL,
format = NULL, style = NULL, basemaps = NA, bubble.size = NULL,
bubble.col = NULL, ...)
shape object, which is one of
In "view"
mode (see tmap_mode
) there are two other options. 1) If omitted, an interactive map without thematic layers is opened. 2) In addition, if a character is provided, this character is used as a search query for OpenStreetMap nominatim. This will position the interactive map accordingly. Arguments of tm_view
, such as set.view
can be passed on directly.tm_
either a color to fill the polygons, or name of the data variable in shp
to draw a choropleth. Only applicable when shp
is type 1 (see above). Set fill=NULL
to draw only polygon borders. See also argument borders
.
either the size of the symbols or a name of the data variable in shp
that specifies the sizes of the symbols. See also the size
arugment of tm_symbols
. Only applicable when shp
is type 1, 2, or 3 (see above).
either the color of the symbols or a name of the data variable in shp
that specifies the colors of the symbols. See also the col
arugment of tm_symbols
. Only applicable when shp
is type 1, 2, or 3 (see above).
either the shape of the symbols or a name of the data variable in shp
that specifies the shapes of the symbols. See also the shape
arugment of tm_symbols
. Only applicable when shp
is type 1, 2, or 3 (see above).
name of the data variable in shp
for the dot map that specifies the colors of the dots. If dots.col
is specified instead symbols.col
, dots instead of bubbles are drawn (unless symbols.shape
is specified).
Name of the data variable that contains the text labels. Only applicable when shp
is type 1, 2, or 3 (see above).
Font size of the text labels. Either a constant value, or the name of a numeric data variable. Only applicable when shp
is type 1, 2, or 3 (see above).
name of the data variable in shp
for the that specifies the colors of the text labels. Only applicable when shp
is type 1, 2, or 3 (see above).
either a line width or a name of the data variable that specifies the line width. Only applicable when shp
is type 3 (see above).
either a line color or a name of the data variable that specifies the line colors. Only applicable when shp
is type 3 (see above).
either a color or a name of the data variable that specifices the raster colors. Only applicable when shp
is type 4, 5, or 6 (see above).
color of the polygon borders. Use NULL
to omit the borders.
data variable name by which the data is split, or a vector of two variable names to split the data by two variables (where the first is used for the rows and the second for the columns). See also tm_facets
numeric value that serves as the global scale parameter. All font sizes, sy mbol sizes, border widths, and line widths are controled by this value. The parameters symbols.size
, text.size
, and lines.lwd
can be scaled seperately with respectively symbols.scale
, text.scale
, and lines.scale
. See also ...
.
main title. For legend titles, use X.style
, where X is the layer name (see ...
).
Either a CRS
object or a character value. If it is a character, it can either be a PROJ.4
character string or a shortcut. See get_proj4
for a list of shortcut values. By default, the projection is used that is defined in the shp
object itself, which can be obtained with get_projection
.
tm_layout
wrapper used for format. Currently available in tmap: "World", "Europe", "NLD", "World_wide", "Europe_wide", "NLD_wide". Own wrappers can be used as well (see details).
tm_layout
wrapper used for style. Available in tmap: "bw", "classic". Own wrappers can be used as well (see details).
basemaps for the view mode. See tm_view
deprecated. Please use symbols.size.
deprecated. Please use symbols.col.
arguments passed on to the tm_*
functions. The prefix of these arguments should be with the layer function name without "tm_"
and a period. For instance, the palette for polygon fill color is called fill.palette
. The following prefixes are supported: shape.
, fill.
, borders.
, polygons.
, symbols.
, dots.
, lines.
, raster.
, text.
, layout.
, grid.
, facets.
, and view.
. Arguments that have a unique name, i.e. that does not exist in any other layer function, e.g. convert2density
, can also be called without prefix.
This function is a convenient wrapper of the main plotting method of stacking tmap-element
s. The first argument is a shape object (normally specified by tm_shape
). The next arguments, from fill
to raster
, are the aesthetics from the main layers. The remaining arguments are related to the map layout. Any argument from any main layer can be specified (see ...
). It is also possible to stack tmap-element
s on a qtm
plot. See examples.
For format
, any character value, say "xxx" can be used if the wrapper function "tm_format_xxx"
exists. The same applies for the argument style
.
# NOT RUN {
data(World, rivers, metro)
# just the map
qtm(World)
# choropleth
qtm(World, fill = "economy", format="World", style="col_blind")
qtm(World, fill="HPI", fill.n=9, fill.palette="div", fill.auto.palette.mapping=FALSE,
fill.title="Happy Planet Index", fill.id="name", format="World", style="gray")
# bubble map
# }
# NOT RUN {
qtm(World, borders = NULL) +
qtm(metro, symbols.size = "pop2010",
symbols.title.size= "Metropolitan Areas",
symbols.id= "name",
format = "World")
# }
# NOT RUN {
# TIP: check out these examples in view mode, enabled with tmap_mode("view")
# }
Run the code above in your browser using DataLab