Learn R Programming

tmap (version 2.0)

print.tmap: Draw thematic map

Description

Draw thematic map. If the tmap mode is set to "plot" (see tmap_mode), the map is plot in the current graphics device. If the mode is set to "view", the map is shown interactively as an htmlwidget.

Usage

# S3 method for tmap
print(x, vp = NULL, return.asp = FALSE,
  mode = getOption("tmap.mode"), show = TRUE, knit = FALSE,
  options = NULL, ...)

knit_print.tmap(x, ..., options = NULL)

Arguments

x

tmap object. A tmap object is created with qtm or by stacking tmap-elements.

vp

viewport to draw the plot in. This is particularly useful for insets.

return.asp

Logical that determines whether the aspect ratio of the map is returned. In that case, grid.newpage() will be called, but without plotting of the map. This is used by tmap_save to determine the aspect ratio of the map.

mode

the mode of tmap: "plot" (static) or "view" (interactive). See tmap_mode for details.

show

logical that determines whether to show to map. Obviously TRUE by default, but show=FALSE can be useful for just obtaining the returned objects.

knit

should knit_print be enabled, or the normal print function?

options

options passed on to knitprint

...

not used

Value

If mode=="plot", then a list is returned with the processed shapes and the metadata. If mode=="view", a leaflet object is returned (see also tmap_leaflet)