Plot light data patterns, optionally with overlayed detected sunrise/sunset events and bouts of cavity use.

cavity_plot(data, cavity = NULL, sun = NULL, loc = NULL, days = 10,
  start = NULL, nrow = NULL, ncol = NULL, clip = TRUE,
  show_night = TRUE)

Arguments

data

Data frame. Raw light data. Requires two columns: "time" and "light"

cavity

Data frame. Bouts of cavity use, output from cavity_detect.

sun

Data frame. sun Data frame. Detected sunrise and sunset events, output of sun_detect

loc

Numeric vector. Optional Longitude and Latitude of the observations (if not in the data, this must be provided if show_night = TRUE).

days

Numeric. Number of days to plot

start

Character. Start date in "YYYY-MM-DD" format

nrow

Numeric. For multi-day figures, number of plot rows.

ncol

Numeric. For multi-day figures, number of plot cols.

clip

Logical. For geolocator light data >64 lux, clip the data to a max of 64? This sometimes makes patterns easier to see.

show_night

Logical. Overlay grey shading to indicate nighttime (defined by local sunrise/sunset times calculated from coordinates).

Value

A ggplot2 figure showing light patterns overlayed with detected sunrise/sunset events and/or bouts of cavity use.

Examples

# Light data only cavity_plot(flicker, days = 1)
# Light data + sunrise/sunset s <- sun_detect(flicker) cavity_plot(flicker, sun = s, days = 1)
# Light data + sunrise/sunset + cavity use s <- sun_detect(flicker) e <- cavity_detect(flicker, sun = s) cavity_plot(flicker, cavity = e, sun = s, days = 1)
# Multi-day plots cavity_plot(flicker, days = 3)
cavity_plot(flicker, days = 5, nrow = 1)
cavity_plot(flicker, days = 5, ncol = 1)
# With clipping cavity_plot(wtsp, days = 1)
# Without clipping cavity_plot(wtsp, days = 1, clip = FALSE)
# Remove nights cavity_plot(wtsp, days = 1, show_night = FALSE)