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

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,
)

## Arguments

x an sf object, a simple feature collection. a data frame that contains identifiers of starting and ending points and a variable. names of the identifier variables in x, character vector of length 2, default to the 2 first columns. (optional) names of the identifier variables in df, character vector of length 2, default to the two first columns. (optional) name of the variable used to plot the links widths. maximum size of the links. color of the links. 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. title of the legend. size of the legend title. size of the values in the legend. number of decimal places of the values displayed in the legend. whether to add a frame to the legend (TRUE) or not (FALSE). whether to add the layer to an existing plot (TRUE) or not (FALSE).

## Note

Unlike most of cartography functions, identifiers variables are mandatory.

## Examples

library(sf)
#> Reading layer mtq' from data source
#>   /tmp/RtmppBiN3A/temp_libpath43d97684eada/cartography/gpkg/mtq.gpkg'
#>   using driver GPKG'
#> Simple feature collection with 34 features and 7 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 690574 ymin: 1592536 xmax: 735940.2 ymax: 1645660
#> Projected CRS: WGS 84 / UTM zone 20Nmob <- read.csv(system.file("csv/mob.csv", package="cartography"))
# Create a link layer - work mobilities to Fort-de-France (97209)
mob.sf <- getLinkLayer(x = mtq, df = mob[mob\$j==97209,], dfid = c("i", "j"))
# Plot the links - Work mobility
plot(st_geometry(mtq), col = "grey60",border = "grey20")
propLinkLayer(x = mob.sf, df = mob,
maxlwd = 10,
legend.pos = "topright",
var = "fij",
col = "#92000090", add = TRUE)
`