| compare_maps | R Documentation |
Compare maps across years
compare_maps(
data_list,
fill_var,
title = NULL,
ncol = NULL,
palette = "viridis",
common_scale = TRUE,
show_state_boundaries = TRUE,
...
)
data_list |
A named list of sf data frames, with names as years |
fill_var |
The variable to map (string) |
title |
Overall title for the combined plot |
ncol |
Number of columns for arrangement |
palette |
Color palette (see |
common_scale |
Logical. Use the same color scale across all maps? |
show_state_boundaries |
Logical. Overlay state boundaries? |
... |
Additional arguments passed to |
A patchwork object
# Compare ST percentage across years
library(dplyr)
st_1971 <- census_1971 |>
filter(geography == "district") |>
mutate(st_pct = 100 * st_population_total / population_total) |>
attach_geometry(1971)
st_2011 <- census_2011_pca |>
mutate(st_pct = 100 * st_population / population_total) |>
attach_geometry(2011)
# Compare
compare_maps(
list("1971" = st_1971, "2011" = st_2011),
fill_var = "st_pct",
title = "ST Population % by District",
palette = "red_blue"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.