plot_hist_attr: Create histogram of an attribute

Description Usage Arguments Details Value

Description

Creates the histogram of a numeric attribute of a lineage or division tree. The histogram can be created for each colony or generation or for the whole population.

Usage

1
2
3
4
plot_hist_attr(tree, treeT = c("LT", "DT"), attr, unit = "",
  grouped = c("col", "gen", "pop"), groups = -1, Ngroups, Nbins = 20,
  save = FALSE, savePars = list(w = 2000, h = 2000, res = 250, path =
  getwd(), name = "my_hist_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. It can be any numeric attribute, as returned from get_attr_names, except for "colony", "generation" and "frame".

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 histogram, 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".

Nbins

Number of equally spaced bins to be used for attr, a non-zero positive integer value >=2. This value is indicative and may change automatically depending on the values of attr, producing a warning message. The default value is 20.

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 2000.

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 250.

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_hist_attr".

Details

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

y-axis represents the cell counts. The range of x-axis values depicted in each plot is common and is calculated as the range of attr values of all specified groups. Binning is applied on the same common range.

Color denotes the corresponding group.

Value

A dataframe with the following columns:

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

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

For groups with Ncells = 0, no plot is generated. In case less than 2 unique cells exist, no plot is generated. In case no cells exist, NULL is returned.


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