plot_dot_attr2_gen2: Create scatter plot of attribute(s) between two generations

Description Usage Arguments Details Value See Also

Description

Creates the X-Y scatter plot of the same or different numeric attribute between cells of two specific generations of a division tree.

Usage

1
2
3
plot_dot_attr2_gen2(DT, gen1, gen2, attr1, unit1 = "", attr2 = "",
  unit2 = "", save = FALSE, savePars = list(w = 2500, h = 2000, res = 350,
  path = getwd(), name = "my_dot_attr2_gen2"))

Arguments

DT

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

gen1

The ID of the first generation in the DT, a positive integer value.

gen2

The ID of the second generation in the DT, a positive integer value.

attr1

The name of the first attribute in the DT, a character string. It can be any numeric attribute, as returned from get_attr_names, except for "colony" and "generation". When attr2 = "", this attribute is used for cells of both generations gen1 and gen2. In other case, this attribute is used for cells of generation gen1.

unit1

The unit of attr1, 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 attr1 is in arbitrary units.

attr2

The name of the second attribute in the DT, a character string. When the default value "" (the empty string) is used, the same attribute attr1 is used for cells of both generations gen1 and gen2. In other case, it can be any numeric attribute, as returned from get_attr_names, except for "colony" and "generation", and it is used for cells of generation gen2.

unit2

The unit of attr2, 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 attr2 is in arbitrary units. This argument is ignored in case attr2 = "".

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

Details

Each data point (x,y) represents the corresponding attribute value of the older and younger cell, respectively. The scatter plot is created for all specified cells that are included in the analysis, as returned from get_cells, except for cells with NA value in attr1 (or attr2 in case attr2 != "").

Data points are purple dot points.

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.