I'm trying to make a map like the one below, using the {{tmap}} package.
That image is from Michael Harper's excellent blog post. It was made using the plot() function, as shown below.
# Loading example data
library(raster) # loads shapefile
# Data Analysis
library(spdep) # builds network
# Load Data
boundaries <- raster::getData(name = "GADM", country = "HUN", level = 2)
# Find neighbouring areas
nb_q <- poly2nb(boundaries)
# Plot original results
coords <- coordinates(boundaries)
# Show the results
plot(boundaries)
plot(nb_q, coords, col="grey", add = TRUE)
I can't figure out how to replicate the second plot() command in tmap. Is there a way to make tmap draw lines between a set of points using an adjacency list as created by spdep::poly2nb() or tmaptools::get_neighbours()?

There's
spdep::nb2lines()to construct lines from the neighbours list, which you can then use as an extra layer fortmap. Following example usessffor all geometries as this is whattmappreferes, but it should work withspas well.Created on 2023-10-24 with reprex v2.0.2