Learn R Programming

tmap (version 0.7)

tm_lines: Draw spatial lines

Description

Creates a tmap-element that draw spatial lines.

Usage

tm_lines(col = "red", lwd = 1, lty = "solid", alpha = NA, scale = 1,
  n = 5, style = "pretty", breaks = NULL, palette = NULL,
  labels = NULL, auto.palette.mapping = TRUE, contrast = 1,
  max.categories = 12, colorNA = "grey65", textNA = "Missing")

Arguments

col
color of the lines. Either a color value or a data variable name.
lwd
line width
lty
line type
alpha
transparency number between 0 (totally transparent) and 1 (not transparent). By default, the alpha value of the col is used (normally 1).
scale
line width multiplier number.
n
preferred number of color scale classes. Only applicable when lwd is the name of a numeric variable.
style
method to cut the color scale: e.g. "fixed", "equal", "pretty", "quantile", or "kmeans". See the details in classIntervals. Only applicable when lwd is the name of
breaks
in case style=="fixed", breaks should be specified
palette
color palette (see RColorBrewer::display.brewer.all) for the lines. Only when col is set to a variable.
labels
labels of the classes
auto.palette.mapping
When diverging colour palettes are used (i.e. "RdBu") this method automatically maps colors to values such that the middle colors (mostly white or yellow) are assigned to values of 0, and the two sides of the color palette are assigned to negative respect
contrast
number between 0 and 1 (default) that determines the contrast of the palette. Only applicable when auto.palette.mapping=TRUE
max.categories
in case col is the name of a categorical variable, this value determines how many categories (levels) it can have maximally. If the number of levels is higher than max.categories, then levels are combined.
colorNA
color used for missing values
textNA
text used for missing values. Use NA to omit text for missing values in the legend

Value

See Also

../doc/tmap-nutshell.html{vignette("tmap-nutshell")}

Examples

Run this code
data(rivers)
data(World)
data(Europe)

tm_shape(World) +
	tm_fill("darkolivegreen3") +
	tm_shape(rivers) +
	tm_lines(col="navy") +
	tm_layout_World("Rivers of the World", inner.margins = c(0,0,.1,0))

tm_shape(Europe) +
    tm_fill("darkolivegreen3") +
    tm_borders("white") +
tm_shape(rivers) +
    tm_lines(col="navy", lwd="scalerank", scale=2) +
tm_layout("Rivers of Europe", legend.show=FALSE)

Run the code above in your browser using DataLab