plot_dot_attr_fam: Create scatter plot of an attribute between family cells

Description Usage Arguments Details Value See Also

Description

Creates the X-Y scatter plot of a numeric attribute between family cells of a division tree. The scatter plot can be created for specific generation(s) or for the whole population.

Usage

1
2
3
plot_dot_attr_fam(DT, attr, unit = "", type = c("s", "c", "md", "gmgd"),
  gens = -1, Ngens, save = FALSE, savePars = list(w = 2500, h = 2000, res
  = 350, path = getwd(), name = "my_dot_attr_fam"))

Arguments

DT

The connected division tree, an object of class "igraph".

attr

The name of the attribute in the DT, a character string. It can be any numeric attribute, as returned from get_attr_names, except for "colony" and "generation".

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.

type

A character string naming the type of the family cells for which to create the scatter plot:

  • "s" for siblings

  • "c" for cousins

  • "md" for mother and daughter

  • "gmgd" for grand-mother and grand-daughter

gens

The IDs of the generations which will be included in the scatter plot, a vector of non-zero positive integer values. When type = "md" or type = "gmgd", each value denotes the generation of the younger cell of the family (i.e. daughter or grand-daughter, respectively). Acceptable values are in the range [1, Ngens-1] in case type = "s" or type = "md" and in the range [2, Ngens-1] in case type = "c" or type = "gmgd". The default value -1 stands for all existing generations in the DT (whole population).

Ngens

Number of generations in the movie, a non-zero positive integer value.

save

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

savePars

A named list specifying the parameters of the 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_dot_attr_fam".

Details

A common scatter plot for all generations specified in gens is created. In the general case, each data point (x,y) represents the attribute value of the older and younger cell of the family, respectively. The scatter plot is created for all specified family cells that are included in the analysis, as returned from get_cells, except for cells with NA value in attr.

Data points are dot points colored based on the generation of the younger cell. Note that when type = "s" or type = "c", there is no distinction between older and younger cell, since both cells are of the same generation.

The linear regression line is also drawn on the plot. X is the predictor variable and Y is the response. The parameters of the regression line are found using the linear least squares method provided by lm.

Value

A named list with the following components:

Ncells

Number of cells, a non-zero positive integer value.

r

The Pearson correlation coefficient (a numeric value in the range [-1, 1]) or NA in case less than 2 unique data points exist.

regression

A named list with the following components:

  • a is the slope of the regression line, a numeric value

  • b is the y-intercept of the regression line, a numeric value

  • r2 is the R-squared coefficient of the regression line as returned from summary.lm, a numeric value in the range [0, 1]

In case less than 2 unique data points exist, NULL is returned, instead.

In case no cells exist, no plot is generated and NULL is returned.

See Also

isConnected for checking if a tree is connected.


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