Renders epoch-level sleep/wake states as a raster with one row per calendar day and time-of-day (00:00 to 24:00) on the x-axis. The oldest day is at the top, following standard chronobiology convention.
Usage
plot_actogram(
result,
tz = NULL,
title = NULL,
colours = NULL,
date_label_every = 7L,
epoch_min = 1,
base_size = 13
)Arguments
- result
A
zeitr_resultlist (fromrun_pipeline()orrun_pipeline_native()), or a tibble with at leastdatetimeandstatecolumns.- tz
character(1)orNULL. Timezone for date and time-of-day extraction.NULL(default) auto-detects from the timezone attribute embedded in thedatetimePOSIXct column; falls back to"UTC"when absent.- title
character(1)orNULL. Plot title.NULLconstructs"Actogram \u2014 <subject_id>"fromresult$subject_idwhen available.- colours
Named character vector mapping state labels (
"wake","sleep","nap","off-wrist") to hex colours.NULLusesactogram_colours().- date_label_every
integer(1). Label every Nth row on the y-axis. Default7(weekly ticks).- epoch_min
numeric(1). Epoch duration in minutes. Used as the tile width inggplot2::geom_tile(). Default1(ActTrust standard).- base_size
numeric(1). Base font size passed toggplot2::theme_minimal(). Default13.
Examples
if (FALSE) { # \dontrun{
result <- run_pipeline("recordings/P001.txt", tz = "America/Sao_Paulo")
# Default colours
plot_actogram(result)
# Custom colours
plot_actogram(result, colours = c(wake = "#E8D5B0", sleep = "#1C1A2E",
nap = "#F0A500", "off-wrist" = "#C25E2A"))
# Label every 14 days
plot_actogram(result, date_label_every = 14L)
} # }