Dear community,
I am using the plot() method (actually plot.nb() method) to visually discover
the neighborhood network generated by poly2nb() and its sibling functions. When
I want to plot only part of the neighborhood network to make a visual
comparison, I intuitively tried something like below, but failed:
library(sf)
library(spdep)
library(spDataLarge)
poly2nb(bristol_zones) -> bqueen
plot(bqueen[5], st_geometry(bristol_zones)) # This line will fail
I am thinking of extracting the neighboring regions into a new sf object, then
drawing the neighborhood network of the new sf object, but it won't give me
what I want: instead of a stellated-shaped ego-network, it still contains the
redundant peripheral edges:
bristol_zones[c(5, bqueen[[5]]), ] -> temp
plot(poly2nb(temp), st_geometry(temp)) # This line generates unwanted
peripheral edges
Is there any built-in or roundabout method to plot part of the nb object?
Merry Christmas and Happy New Year!
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo