plotRatios: Plot global/group residency

View source: R/plot.R

plotRatiosR Documentation

Plot global/group residency

Description

By default, this function plots the global residency. However, you can use the argument 'group' to plot the results only from a specific animal group. Lastly, you can also use 'sections', rather than 'group', to compare the residency at a specific section (or group of sections) between the different groups.

Usage

plotRatios(
  input,
  groups,
  sections,
  type = c("absolutes", "percentages"),
  title,
  xlab,
  ylab,
  col,
  col.by = c("default", "section", "group")
)

Arguments

input

The results of an actel analysis (either explore, migration or residency).

groups

An optional argument to plot only the data corresponding to some groups.

sections

An optional argument to plot the residency of the multiple groups for a specific subset of sections.

type

The type of residency to be displayed. One of 'absolutes' (the default) or 'percentages'.

title

An optional title for the plot. If left empty, a default title will be added.

xlab, ylab

Optional axis names for the plot. If left empty, default axis names will be added.

col

An optional colour scheme for the detections. If left empty, default colours will be added.

col.by

Colour scheme to use. One of 'section' or 'group'. By default, plots are coloured by section if all sections are displayed, and by group if only a subset of the sections is required using the argument sections.

Details

The output of plotRatios is a ggplot object, which means you can then use it in combination with other ggplot functions, or even together with other packages such as patchwork.

Value

A ggplot object.

Examples

# For this example, I have modified the example.results that come with actel,
# so they resemble a residency output

plotRatios(example.residency.results)

# Because plotRatios returns a ggplot object, you can store
# it and edit it manually, e.g.:
library(ggplot2)
p <- plotRatios(example.residency.results, groups = "A")
p <- p + xlab("changed the x axis label a posteriori")
p

# You can also save the plot using ggsave!


actel documentation built on Oct. 19, 2023, 9:08 a.m.