Generic time-series line chart for any indicator tibble keyed by nuts3_code/province_name/year, such as the output of age_dependency_ratio(), aging_index(), sex_ratio(), crude_birth_rate(), or life_expectancy_summary().

plot_demog_trend(df, value_col, region = NULL, title = NULL, ylab = NULL)

Arguments

df

A tibble with province_name, year, and value_col.

value_col

Character, the name of the column to plot.

region

Optional character vector to subset by province name (regular expressions allowed, matched against province_name); one line is drawn per matched province. If NULL (default), every province present in df is plotted.

title

Optional plot title.

ylab

Optional y-axis label (defaults to value_col).

Value

A ggplot object.

Examples

trend <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna",
  year = c(2022, 2023), aging_index = c(150, 160)
)
plot_demog_trend(trend, "aging_index")