【发布时间】:2019-03-21 13:52:21
【问题描述】:
R 中有一个名为“flows”(details here) 的包,它允许您绘制流交互图(通过函数 plotMapDomFlows() 从流的平方矩阵中绘制。这是一个例如,使用包中包含的数据,输出的样子:
# Import data
data(nav)
myflows <- prepflows(mat = nav, i = "i", j = "j", fij = "fij")
# Remove the matrix diagonal
diag(myflows) <- 0
# Select flows that represent at least 20% of the sum of outgoing flows for
# each urban area.
flowSel1 <- firstflows(mat = myflows/rowSums(myflows)*100, method = "xfirst",
k = 20)
# Select the dominant flows (incoming flows criterion)
flowSel2 <- domflows(mat = myflows, w = colSums(myflows), 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)
我想使用 R 将这些线和多边形放在传单地图上。
有什么想法吗?
【问题讨论】:
标签: r leaflet geography gis cartography