List of available plots - chronopsychiatry/AmbientViewer GitHub Wiki
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.
Original design by Cathy Wyse.
Command line
plot <- plot_sleep_spiral(epochs)
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.
Original design by Cathy Wyse.
Command line
plot <- plot_sleep_clock(sessions)
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
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")
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.
Original design by Cathy Wyse.
Command line
plot <- plot_sleep_bubbles(sessions)
A hypnogram showing the different sleep phases over time.
Command line
plot <- plot_hypnogram(epochs)
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.
Command line
plot <- plot_timeseries_sessions(sessions, variable = "temperature_filtered_mean", exclude_zero = FALSE)
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.
Command line
plot <- plot_timeseries(epochs, variable = "temperature_ambient_mean", exclude_zero = TRUE)
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)