Skip to contents

Creates a time series plot from HMIS data, with one line per state (and optionally per indicator or district).

Usage

plot_time_series(
  data,
  y = "value",
  color = "state",
  facet = NULL,
  title = NULL,
  y_label = "Value",
  scales = "free_y"
)

Arguments

data

A data frame from get_hmis().

y

Column to plot on the y-axis. Default "value".

color

Column for color grouping. Default "state".

facet

Optional column to facet by (e.g., "canonical_name" or "district"). Default NULL.

title

Plot title. Default auto-generated from indicator name.

y_label

Y-axis label. Default "Value".

scales

Facet scales argument. Default "free_y".

Value

A ggplot object.

Examples

if (FALSE) { # \dontrun{
births <- get_hmis("male live births",
  state = c("Bihar", "Kerala"),
  category = "Total", sector = "Total"
)
plot_time_series(births)
} # }