Plot representative point diagnostics
Source:R/representative-points.R
plot_representative_points.RdVisualize the population-weighted representative point selection for one or more census tracts. Shows the population raster, identified clusters, OSM roads, and the selected departure point.
Usage
plot_representative_points(
result,
tracts_sf = NULL,
pop_raster = NULL,
tract = NULL,
osm_roads = NULL,
...
)Arguments
- result
An
interpElections_resultobject, or ansfPOINT object returned bycompute_representative_points().- tracts_sf
Census tract polygons. Extracted from
resultif available, otherwise required.- pop_raster
A terra::SpatRaster or
NULL. Extracted fromresultif available. Required for single-tract detail view.- tract
Character vector. Tract IDs to plot in detail. If
NULL(default), shows a summary map of all tracts.- osm_roads
An
sfobject with road geometries, orNULL. Extracted fromresultif available.- ...
Ignored.
Examples
if (FALSE) { # \dontrun{
result <- interpolate_election_br(3170701, 2022,
keep = c("pop_raster", "osm_roads"))
# Summary: all tracts with cluster counts
plot_representative_points(result)
# Detail: single tract showing raster, clusters, roads, point
plot_representative_points(result, tract = "317070105000138")
} # }