netmap_plot | R Documentation |
sf
objectWrapper 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.
netmap_plot(n, m, lkp = NULL, m_name = NULL, n_name = "vertex.names", ...)
n |
A |
m |
A |
lkp |
An optional lookup table. |
m_name |
Optional |
n_name |
Optional |
... |
Additional parameters passed to |
A plot of the network.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.