plot_single_map: Build a tmap for a single variable

View source: R/plot_maps.R

plot_single_mapR Documentation

Build a tmap for a single variable

Description

Creates a thematic map using the tmap package for a single variable in an sf object.

Usage

plot_single_map(sf_data, var, title, palette = "reds")

Arguments

sf_data

An sf object containing spatial data.

var

Variable name as a string to map.

title

Legend title for the fill legend.

palette

Color palette for the map (default is "reds").

Value

A tmap object representing the thematic map.

Examples


library(sf)
# Create example sf object
nc <- st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc$incidence <- runif(nrow(nc), 0, 100)

# Plot
p1 <- plot_single_map(nc, "incidence", "Incidence")


mlspatial documentation built on Aug. 27, 2025, 1:09 a.m.