List of available plots - chronopsychiatry/AmbientViewer GitHub Wiki

Sleep Spiral

The sleep spiral shows the awake and sleep times over several nights. Each turn of the spiral corresponds to 24 hours, with awake time shown in orange, and the different sleep phases in shades of purple.

Example of a sleep spiral plot

Original design by Cathy Wyse.

Command line
plot <- plot_sleep_spiral(epochs)

Sleep Clock

The sleep clock shows the time at sleep onset (purple lines) and wake-up (orange lines) to illustrate their variability. The length of the clock arms varies with the date of the sessions, and the curved lines highlight the session lengths.

Example of a sleep clock plot

Original design by Cathy Wyse.

Command line
plot <- plot_sleep_clock(sessions)

Sleep onset & Wakeup

The average sleep onset and wakeup times graph shows the average times at which the subject feel asleep and woke up, averaged either:

  • Night by night (in that case the value is expected to be the result of a single sleep session)
  • By day of the week (Monday to Sunday)
  • By week vs. weekend

Example of a Sleep onset & wakeup plot

Command line
# Group by night
plot <- plot_bedtimes_waketimes(sessions, groupby = "night")

# Group by day of the week
plot <- plot_bedtimes_waketimes(sessions, groupby = "weekday")

# Group by week/weekend
plot <- plot_bedtimes_waketimes(sessions, groupby = "workday")

Sleep Bubbles

The sleep bubbles illustrate the duration of sleep over several days. Their colour changes from blue to green according to sleep duration, or grey if they correspond to a session of less than 6 or more than 9 hours of sleep. The grey area illustrate the 6-9 hour time window.

Example of a sleep bubbles plot

Original design by Cathy Wyse.

Command line
plot <- plot_sleep_bubbles(sessions)

Hypnogram

A hypnogram showing the different sleep phases over time.

Example of a hypnogram

Command line
plot <- plot_hypnogram(epochs)

Session timeseries

A plot showing the evolution of different session variables over days. The variable to be displayed can be selected using the Select Variable menu.

Tip: typing keywords in the Select Variable menu will search matching variables.

The Exclude Zero Values box can be checked to remove all 0 values from the plot.

Ambient Viewer view of a sessions timeseries plot with options

Command line
plot <- plot_timeseries_sessions(sessions, variable = "temperature_filtered_mean", exclude_zero = FALSE)

Epochs timeseries

A plot showing the evolution of epoch variables over time (12pm to 12pm, next day). Similarly to the Sessions timeseries, the variable to plot can be selected using the Select Variable menu, and zero values can be removed by ticking the corresponding box. Each day included in the data will be plotted as a line of a different colour.

Ambient Viewer GUI showing an epochs timeseries plot with options

Command line
plot <- plot_timeseries(epochs, variable = "temperature_ambient_mean", exclude_zero = TRUE)

Notes on generating the plots on the command line

All plot functions return a plot object which can be further edited, and which must be printed to display the plot.

For example, this code snippet imports session data, plots a sleep clock and changes the plot title:

sessions <- load_sessions("path/to/sessions.csv")
plot <- plot_sleep_clock(sessions) +
  ggplot2::ggtitle("Sleep onset and wake times") +
  ggplot2::theme(
    plot.title = ggplot2::element_text(
      hjust = 0.5,
      face = "bold",
      size = 24
    )
  )

print(plot)
⚠️ **GitHub.com Fallback** ⚠️