netmap_plot {netmap} | R Documentation |
Plot a network object with a layout based on an sf
object
Description
Wrapper for plot.network
and
plot.igraph
using a custom network layout that extracts
coordinates of centroids from a sf
object. Only vertices with a
corresponding feature are plotted.
Usage
netmap_plot(n, m, lkp = NULL, m_name = NULL, n_name = "vertex.names", ...)
Arguments
n |
A |
m |
A |
lkp |
An optional lookup table. |
m_name |
Optional |
n_name |
Optional |
... |
Additional parameters passed to |
Value
A plot of the network.
Examples
net=network::network(matrix(c(0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0), nrow=4, byrow=TRUE))
network::set.vertex.attribute(net, "name", value=c("a", "b", "c", "d"))
wkb = structure(list("01010000204071000000000000801A064100000000AC5C1641",
"01010000204071000000000000801A084100000000AC5C1441",
"01010000204071000000000000801A044100000000AC5C1241",
"01010000204071000000000000801A024100000000AC5C1841"), class = "WKB")
map=sf::st_sf(id=c("a1", "b2", "c3", "d4"), sf::st_as_sfc(wkb, EWKB=TRUE))
lkptbl=data.frame(id=c("a1", "b2", "c3", "d4"), name=c("a", "b", "c", "d"))
netmap::netmap_plot(net, map, lkptbl, "id", "name")
[Package netmap version 0.1.4 Index]