plot_time_attr: Plot mean and sd of an attribute per frame

Description Usage Arguments Details Value

Description

Computes and plots the mean and standard deviation of a numeric attribute of a lineage or division tree per frame. The plot can be created for each colony or generation or for the whole population.

Usage

1
2
3
4
plot_time_attr(tree, treeT = c("LT", "DT"), attr, unit = "",
  grouped = c("col", "gen", "pop"), groups = -1, Ngroups, save = FALSE,
  savePars = list(w = 2500, h = 2000, res = 350, path = getwd(), name =
  "my_time_attr"))

Arguments

tree

The lineage or division tree, an object of class "igraph".

treeT

A character string naming the type of tree:

  • "LT" if tree is a lineage tree

  • "DT" if tree is a division tree

attr

The name of the attribute in the tree, a character string. In case treeT = "LT", it can be any numeric attribute, as returned from get_attr_names, except for "colony", "generation" and "frame". In case treeT = "DT", it can be any numeric attribute, as returned from get_attr_names, having the suffix "_birth" or "_division".

unit

The unit of attr, a character string. It should be in the format "<string>,<number>", where ",<number>" represents the power and is optional (e.g. "m" for meters and "cm,3" for cubic centimeters). The default value is the empty character "", which implies that attr is in arbitrary units.

grouped

A character string naming the grouping method:

  • "col" for grouping by colony

  • "gen" for grouping by generation

  • "pop" for no grouping (whole population)

groups

The IDs of the groups for which to create the plot, a vector of positive integer values. This argument is ignored in case grouped = "pop". The default value -1 stands for all existing groups in the tree.

Ngroups

Number of colonies in the movie (if grouped = "col") or number of generations in the movie (if grouped = "gen"), a non-zero positive integer value. This argument is ignored in case grouped = "pop".

save

A logical value (TRUE or FALSE) indicating whether the generated plot(s) will be saved in .png file(s) or displayed in the Plots Pane of RStudio, respectively. The default value is FALSE.

savePars

A named list specifying the parameters of each generated image file. This argument is ignored in case save = FALSE. Elements of the list are the following:

w

The width of the image file in pixels, a non-zero positive integer value. The default value is 2500.

h

The height of the image file in pixels, a non-zero positive integer value. The default value is 2000.

res

The resolution of the image file in pixels per inch (ppi), a non-zero positive integer value. The smaller this value, the larger the plot area in inches, and the smaller the text relative to the graph itself. The default value is 350.

path

A character string naming the directory where the image file will be saved (excluding the last "/"). If it does not contain an absolute path, the image file will be saved relative to the current working directory getwd(). The default value is the current working directory getwd().

NOTE: The components should be separated by "/" on Windows.

name

The image file name, a character string. The suffix ".png" is added automatically. The default value is "my_time_attr".

Details

A separate plot for each group specified in groups is generated. Each plot is created considering all cells that are included in the analysis, as returned from get_cells, except for cells with NA value in attr.

x-axis represents the time in frames. The range of x and y-axis values depicted in each plot is common and is calculated as the range of the corresponding values of all specified groups.

Color denotes the corresponding group.

Value

A named list with the following components:

group

The ID of the group (a positive integer value) or -2 in case grouped = "pop".

data

A dataframe with the following columns:

  1. frame is the frame ID, a non-zero positive integer value.

  2. Ncells is the number of cells, a positive integer value.

  3. mean is the mean of attr, a numeric value.

  4. sd is the standard deviation of attr, a positive numeric value or NA in case Ncells = 1.

For groups with no cells, no plot is generated and NULL is returned.


vicstefanou/ViSCA documentation built on May 31, 2019, 10:50 p.m.