How do I fix vertical space issues in tmap legends, like the ones shown in the linked base R example? (Vertical spaces in legend; y.intersp
is not a recognized parameter by tmap_add_legend()
)
Basic tmap code:
library(sf)
library(tmap)
tm_shape(st_read(system.file('shape/nc.shp', package = 'sf'))) +
tm_polygons() +
tm_add_legend(
type = 'symbol',
labels = c('Variable A', 'Variable B', 'Variable C', 'Variable D', 'Variable E'),
col = c('#832424FF', 'rosybrown4', 'red', 'red', '#4F8DC2'),
shape = c(19, 19, 4, 5, 15)
)