Description Usage Arguments See Also Examples
This function plots a dominant flows map.
1 2 3 4 5 | plotMapDomFlows(mat, spdf, spdfid, w, wid, wvar, wcex = 0.05,
legend.flows.pos = "topright", legend.flows.title = "flow intensity",
legend.nodes.pos = "topleft", legend.node.txt = c("Dominant",
"Intermediary", "Dominated", "Size proportional\nto sum of inflows"),
add = FALSE)
|
mat |
A square matrix of dominant flows (see domflows). |
spdf |
A SpatialPolygonsDataFrame or a SpatialPointsDataFrame of units. |
spdfid |
Name of the unique identifier variable in the spdf data.frame. |
w |
A data.frame which contains the weight variable used to plot units sizes on the map. |
wid |
Name of the unique identifier variable in w. |
wvar |
Name of the weight variable in w. |
wcex |
Share of the surface of the map occupied by circles (0.02 is 2%). |
legend.flows.pos |
Position of the flows legend, one of "topleft", "top", "topright", "left", "right", "bottomleft", "bottom", "bottomright". |
legend.flows.title |
Title of the flows legend. |
legend.nodes.pos |
Position of the nodes legend, one of "topleft", "top", "topright", "left", "right", "bottomleft", "bottom", "bottomright". |
legend.node.txt |
Text of the nodes legend. |
add |
A boolean, if TRUE, add the layer to an existing plot. |
domflows, plotDomFlows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Import data
data(nav)
myflows <- prepflows(mat = nav, i = "i", j = "j", fij = "fij")
# Remove the matrix diagonal
diag(myflows) <- 0
# Select the dominant flows (incoming flows criterion)
flowSel1 <- domflows(mat = myflows, w = colSums(myflows), k = 1)
# Select the first flows
flowSel2 <- firstflows(mat = myflows, method = "nfirst", ties.method = "first",
k = 1)
# Combine selections
flowSel <- myflows * flowSel1 * flowSel2
# Node weights
inflows <- data.frame(id = colnames(myflows), w = colSums(myflows))
# Plot dominant flows map
opar <- par(mar = c(0,0,2,0))
sp::plot(GE, col = "#cceae7", border = NA)
plotMapDomFlows(mat = flowSel, spdf = UA, spdfid = "ID", w = inflows, wid = "id",
wvar = "w", wcex = 0.05, add = TRUE,
legend.flows.pos = "bottomleft",
legend.flows.title = "Nb. of commuters")
title("Dominant Flows of Commuters")
mtext(text = "INSEE, 2011", side = 4, line = -1, adj = 0.01, cex = 0.8)
par(opar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.