Learn R Programming

cartography (version 2.1.0)

propLinkLayer: Proportional Links Layer

Description

Plot a layer of proportional links. Links widths are directly proportional to values of a variable.

Usage

propLinkLayer(x, df, xid = NULL, dfid = NULL, var, maxlwd = 40, col,
  legend.pos = "bottomleft", legend.title.txt = var,
  legend.title.cex = 0.8, legend.values.cex = 0.6, legend.values.rnd = 0,
  legend.frame = FALSE, add = TRUE, spdf, spdfid, spdfids, spdfide, dfids,
  dfide)

Arguments

x

an sf object, a simple feature collection.

df

a data frame that contains identifiers of starting and ending points and a variable.

xid

identifier fields in x, character vector of length 2, default to the 2 first columns. (optional)

dfid

identifier fields in df, character vector of length 2, default to the two first columns. (optional)

var

name of the variable used to plot the links widths.

maxlwd

maximum size of the links.

col

color of the links.

legend.pos

position of the legend, one of "topleft", "top", "topright", "right", "bottomright", "bottom", "bottomleft", "left" or a vector of two coordinates in map units (c(x, y)). If legend.pos is "n" then the legend is not plotted.

legend.title.txt

title of the legend.

legend.title.cex

size of the legend title.

legend.values.cex

size of the values in the legend.

legend.values.rnd

number of decimal places of the values displayed in the legend.

legend.frame

whether to add a frame to the legend (TRUE) or not (FALSE).

add

whether to add the layer to an existing plot (TRUE) or not (FALSE).

spdf

defunct.

spdfid

defunct.

spdfids

defunct.

spdfide

defunct.

dfids

defunct.

dfide

defunct.

See Also

gradLinkLayer, getLinkLayer, legendPropLines

Examples

Run this code
# NOT RUN {
library(sp)
data("nuts2006")
# Create a link layer of the twin cities agreements
twincities.spdf <- getLinkLayer(x = nuts2.spdf, df = twincities.df[,1:2])
# Plot the links - Twin cities agreements between regions 
plot(nuts0.spdf, col = "grey60",border = "grey20")
propLinkLayer(x = twincities.spdf, df = twincities.df[twincities.df$fij>=5,],
              maxlwd = 10,
              legend.pos = "topright",
              var = "fij", 
              col = "#92000090", add = TRUE)
# }

Run the code above in your browser using DataLab