Plots a line graph of the individual metrics over time.

plot_metric(
  metric,
  metrics,
  days = "all",
  subjects = "all",
  scheme = "rainbow",
  col = NULL,
  file = NULL,
  cex.axis = 1,
  las = 2,
  mar = c(8, 8, 4, 0),
  plot = TRUE
)

Arguments

metric

The name of the metric that is to be plotted.

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.

scheme

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

col

A named vector of colours. This vector must contain the SubjectIDs as names. Any subjects not present in this vector will be drawn in black. If not NULL, then this parameter overrides scheme. Default is NULL.

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.

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.

plot

If FALSE, then the plot is not drawn and only the plotting data are returned.

Details

The data used in plotting (the plotted values for each subject and the colours) are returned invisibly to enable further plot customisation.