Learn R Programming

tmap (version 2.3-2)

tm_sf: Draw simple features

Description

Creates a tmap-element that draws simple features. Basically, it is a stack of tm_polygons, tm_lines and tm_dots. In other words, polygons are plotted as polygons, lines as lines and points as dots.

Usage

tm_sf(
  col = NA,
  size = 0.02,
  shape = 16,
  lwd = 1,
  lty = "solid",
  alpha = NA,
  palette = NULL,
  border.col = NA,
  border.lwd = 1,
  border.lty = "solid",
  border.alpha = NA,
  group = NA,
  ...
)

Arguments

col

color of the simple features. See the col argument of tm_polygons, tm_lines and tm_symbols.

size

size of the dots. See the size argument tm_symbols. By default, the size is similar to dot size (see tm_dots)

shape

shape of the dots. See the shape argument tm_symbols. By default, dots are shown.

lwd

width of the lines. See the lwd argument of tm_lines

lty

type of the lines. See the lty argument of tm_lines

alpha

transparency number. See alpha argument of tm_polygons, tm_lines and tm_symbols

palette

palette. See palette argument of tm_polygons, tm_lines and tm_symbols

border.col

color of the borders. See border.col argument of tm_polygons and tm_symbols.

border.lwd

line width of the borders. See border.lwd argument of tm_polygons and tm_symbols.

border.lty

line type of the borders. See border.lwd argument of tm_polygons and tm_symbols.

border.alpha

transparency of the borders. See border.alpha argument of tm_polygons and tm_symbols.

group

name of the group to which this layer belongs in view mode. Each group can be selected or deselected in the layer control item. Set group = NULL to hide the layer in the layer control item. By default, it will be set to the name of the shape (specified in tm_shape).

...

other arguments passed on to tm_polygons, tm_lines and tm_symbols

Value

tmap-element

See Also

vignette("tmap-getstarted")

Examples

Run this code
# NOT RUN {
data(World)

World$geometry[World$continent == "Africa"] <- 
  sf::st_centroid(World$geometry[World$continent == "Africa"])
World$geometry[World$continent == "South America"] <- 
  sf::st_cast(World$geometry[World$continent == "South America"], 
    "MULTILINESTRING", group_or_split = FALSE)

tm_shape(World) + 
	tm_sf()
# }

Run the code above in your browser using DataLab