Learn R Programming

ggetho (version 0.3.5)

ggspectro: Prepare a ggplot object to represent spectrogram data

Description

This function summarises spectrogram data (containing spectrograms of multiple individual), to show period on the y axis, time on the x axis and power on the z axis (e.g. as a colour).

Usage

ggspectro(data, mapping = aes(), summary_FUN = mean,
  summary_time_window = mins(30), time_wrap = NULL, time_offset = 0,
  ...)

Arguments

data

behavr::behavr table containing the data and metadata

mapping

default list of aesthetic mappings to use for plot

summary_FUN

method (function) used to summarise variable over time (typically, the mean)

summary_time_window

width (in seconds) of the time window to compute a summary on

time_wrap

time (in seconds) used to wrap the data (see details)

time_offset

time offset (i.e. phase, in seconds) when using time_wrap

...

additional arguments to be passed to ggplot2::ggplot()

Value

An initial ggplot object that can be further edited.

References

See Also

  • ggperio to visualise periodograms

Examples

Run this code
# NOT RUN {
library(zeitgebr)
data(dams_sample)
dt <- dams_sample
spect_dt <- spectrogram(activity, dt)
pl <- ggspectro(spect_dt,time_wrap = hours(24)) +
  stat_tile_etho() +
  scale_y_hours(log=TRUE) +
  stat_ld_annotations(ld_colours = c("grey","black"))
pl + facet_grid(period_group ~ .)
pl + facet_wrap(~ id)
# }

Run the code above in your browser using DataLab