Skip to contents

Creates choropleth maps of DHS indicator data at Admin 1 level across Sub-Saharan Africa using tmap.

Usage

plot_dhs_map(panel, admin1_geo = NULL, var, years = NULL,
  title = NULL, palette = "viridis", n_breaks = 7, breaks = NULL,
  bb_x = c(-18, 52), bb_y = c(-36, 18), basemap = TRUE,
  pdf_file = NULL)

Arguments

panel

Dataframe from cascade_to_admin1().

admin1_geo

sf object from get_admin1_geo(). If NULL, fetched automatically.

var

Character string of variable to plot.

years

Integer vector of years to plot. If NULL, uses most recent.

title

Optional custom title. If NULL, uses DHS variable label.

palette

Character: tmap/viridis palette (default: "viridis").

n_breaks

Integer: number of legend breaks (default: 7).

breaks

Optional custom breaks vector.

bb_x

Numeric vector of longitude limits (default: Africa extent).

bb_y

Numeric vector of latitude limits (default: Africa extent).

basemap

Logical: draw country borders (default: TRUE).

pdf_file

Optional PDF filename for output.

Value

Prints tmap objects for each year.

Examples

if (FALSE) { # \dontrun{
plot_dhs_map(panel, var = "u5_mortality", years = 2020)
} # }