map_nodal_flows: Nodal flows map

View source: R/nodal_flows.R

map_nodal_flowsR Documentation

Nodal flows map

Description

Perform a Nystuen & Dacey's dominants, or nodal, flows analysis and plot a dominant flows map.

Usage

map_nodal_flows(
  mat,
  x,
  inches = 0.15,
  col_node = c("red", "orange", "yellow"),
  breaks = "equal",
  nbreaks = 4,
  lwd = c(1, 5, 10, 20),
  col_flow = "grey20",
  leg_node = c("Dominant", "Intermediate", "Dominated",
    "Size proportional\nto sum of inflows"),
  leg_flow = "Flow intensity",
  leg_pos_flow = "topleft",
  leg_pos_node = "topright",
  add = FALSE
)

Arguments

mat

A square matrix of flows.

x

An sf object, the first column contains a unique identifier matching mat column and row names.

inches

Size of the largest circle.

col_node

Node colors, a vector of 3 colors.

breaks

How to classify flows, either a numeric vector with the actual breaks, or a classification method name (see mf_get_breaks())

nbreaks

Number of classes.

lwd

Flows widths

col_flow

Flows color

leg_node

Labels for the nodes legend

leg_flow

Label for the flows legend

leg_pos_flow

Position of the flows legend

leg_pos_node

Position of the node legend

add

A boolean, if TRUE, add the layer to an existing plot.

Value

A list of sf objects is returned. The first element contains the nodes with their weight and classification (dominant, intermediary, dominated). The second element contains the flows (i, j, fij)

Examples

library(sf)
library(mapsf)
nav <- read.csv(system.file("csv/nav.csv", package = "flows"))
mat <- prepare_mat(x = nav, i = "i", j = "j", fij = "fij")
UA <- st_read(system.file("gpkg/GE.gpkg", package = "flows"), layer = "urban_area")
GE <- st_read(system.file("gpkg/GE.gpkg", package = "flows"), layer = "region")
mf_map(GE)
map_nodal_flows(
  mat = mat, x = UA,
  col_node = c("red", "orange", "yellow"),
  col_flow = "grey30",
  breaks = c(4, 100, 1000, 2500, 8655),
  lwd = c(1, 4, 8, 16), add = TRUE
)
mf_title("Dominant flows")

rCarto/flows documentation built on May 10, 2024, 11:38 a.m.