Creates a ggplot that overlays state events (durative bouts, drawn as
horizontal bars by geom_event_state()) and point events
(instantaneous occurrences, drawn as dots by
geom_event_point()) on a shared time axis. Each behaviour label
becomes a row on the y axis.
Usage
plot_events(data, ...)
# S3 method for class 'anievent'
plot_events(
data,
...,
layout = c("facet", "inline"),
point_style = c("point", "raster"),
mode = c("light", "dark")
)
# Default S3 method
plot_events(
data = NULL,
point = NULL,
...,
point_style = c("point", "raster"),
mode = c("light", "dark")
)Arguments
- data
An anievent object, or a data frame of state events for the default method.
- ...
Additional arguments (currently unused).
- layout
For
plot_events.anievent(): either"facet"(default, one y row per label with channels faceted) or"inline"(an ethogram — one y row per channel with labels in a colour legend).- point_style
How point events are drawn:
"point"(default, dots) or"raster"(vertical ticks, the classic spike-raster look). Passed togeom_event_point().- mode
Either
"light"(default) or"dark"; passed totheme_animovement().- point
For the default method only: an optional data frame of point events. Ignored by
plot_events.anievent().
Details
Two dispatches:
plot_events.anievent()— auto-detects which rows are states and which are points by reading thetypecolumn. Thelayoutargument chooses how channels and labels are arranged:"facet"(default): eachlabelis a y-axis row, and multiplechannels become facet rows (with free y-scales). Anyvariables_whatcolumn with more than one level adds a facet column per identity —facet_grid()when both vary, otherwisefacet_wrap()."inline"(ethogram): eachchannelis a single y-axis row andlabelmoves to a colour legend, so all channels share one panel.
plot_events.default()— for callers without an anievent. Pass the state events as the first arg and the point events viapoint; either may beNULL. No automatic faceting.