## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 14,
  fig.height = 7,
  out.width = "100%"
)

## ----setup--------------------------------------------------------------------
library(actiplot)

## ----data---------------------------------------------------------------------
activity <- acti_minute_data

## ----full-time----------------------------------------------------------------
acti_plot_time(activity, counts, breaks = "4 hours")

## ----full-time-readable-axis--------------------------------------------------
acti_plot_time(activity, counts, x_axis = "12 hours")
acti_plot_time(activity, counts, x_axis = "midnight")

## ----daily, fig.height=12-----------------------------------------------------
acti_plot_day(activity, counts, breaks = "4 hours")

## ----daily-facet-labels, fig.height=12----------------------------------------
acti_plot_day(activity, counts, facet = "month-day")
acti_plot_day(activity, counts, facet = "day")

## ----heatmap, fig.height=9----------------------------------------------------
acti_plot_heatmap(activity, counts, breaks = "4 hours")

## ----actogram, fig.height=9---------------------------------------------------
acti_plot_actogram(activity, counts, breaks = "4 hours")

## ----minute-profile-----------------------------------------------------------
acti_plot_minute_profile(activity, counts, summary = "median")

## ----intervals----------------------------------------------------------------
sleep_windows <- data.frame(
  start = as.POSIXct(c("2017-06-03 22:00:00", "2017-06-04 22:00:00"), tz = "GMT"),
  end = as.POSIXct(c("2017-06-04 07:00:00", "2017-06-05 07:00:00"), tz = "GMT")
)

acti_plot_time(activity, counts) +
  geom_sleep_window(sleep_windows) +
  geom_day_boundary("noon", linetype = "dashed")

## ----episode-and-wear---------------------------------------------------------
acti_plot_time(activity, counts) +
  geom_episode(sleep_windows, fill = "grey30", alpha = 0.10) +
  geom_wear(sleep_windows)

## ----rug-threshold-vline------------------------------------------------------
acti_plot_time(activity, counts) +
  geom_activity_rug(activity[activity$counts > 10000, ]) +
  geom_threshold_band(activity, "counts", threshold = 10000) +
  geom_time_vline(xintercept = "12:00:00", linetype = "dotted")

