Plots a heatmap representation of the high-level ethogram metrics.

plot_ethogram(
  metrics,
  days = "all",
  subjects = "all",
  plot = "all",
  scheme = "yrb",
  file = NULL,
  width = NULL,
  height = NULL,
  cex.axis = 0.75,
  las = 2,
  mar = c(5, 8, 0, 0)
)

Arguments

metrics

A colonytrack_metrics object, as returned by calculate_metrics.

days

Specify the days to be included is the metrics calculation. This may be in any of the standard formats (names, indices, or a logical vector). Default is to include all days present in the input data file.

subjects

Specify the subjects to be included is the metrics calculation. This may be in any of the standard formats (names, indices, or a logical vector). Default is to include all subjects present in the input data file. If a vector of subjects is supplied, the resulting plot will respect the ordering of this vector.

plot

A character vector describing which behavioural categories ('activity', 'sociality' and 'exploration') should be plotted. Abbreviations may also be used. The default, 'all', plots all three categories mixed using a colour model determined by the parameter 'scheme'. Note that if 'all' is present in any of the elements of this argument, then it will override any other elements. If plot is FALSE, then all plotting is suppressed and only the ethogram colours and components are returned (see below).

scheme

A code specifying the colour scheme to be used. See Details for information on the available schemes. Default is 'yrb'.

file

An optional filename for PDF output. If supplied, the plot will be written to a PDF document with this name. The file is saved relative to the working directory. The default is to plot to the active graphics device.

width

The width of the PDF (only if file is specified) in mm.

height

The height of the PDF (only if file is specified) in mm.

cex.axis

The scaling factor for the axis labels (see par). Default (0.75) can be overridden for different sized plot devices.

las

The label aspect (see par. Can be overridden based on the user's preferences.

mar

The margins surrounding the plot (see par). Can be overridden for different length ID labels or to match different sized plot devices.

Value

Invisibly returns a list with the components 'ethogram' (a matrix of the colours of each cell), and 'activity', 'sociality' and 'exploration' (matrices with the values for each component respectively).

Details

This function uses the three high-level metrics 'activity', 'sociality' and 'exploration' and produces a heatmap representation for all subjects over the given time period.

Available colour schemes are 'rgb' ('activity' in the red channel, 'sociality' in the green channel and 'exploration' in the blue channel). Scheme variants beginning with 'd' use discrete colouring such that the most prevalent activity in any time block is taken as the colour (the default is to mix the components). The scheme family 'ymc' uses yellow for 'activity', magenta for 'sociality' and cyan for 'exploration'. The discrete and scaled versions are also available for this scheme. The (default) scheme family 'yrb' uses yellow for 'activity', red for 'sociality' and blue for 'exploration' in a subtractive colour model. The activity and sociality scores are scaled and thresholded to fall within the range 0-1. The scheme 'basic' uses a discrete colour mapping based on a subtractive colouring so that yellow = 'activity', red = 'sociality', blue = "exploration", orange = 'activity' and 'sociality', green = 'activity' and 'exploration', purple = 'sociality' and 'exploration', brown indicates the presence of all three features and white the absence of all features.