plot_dot_attr2: Create scatter plot of two attributes

Description Usage Arguments Details Value

Description

Creates the X-Y scatter plot of two numeric attributes of a lineage or division tree.

Usage

1
2
3
4
plot_dot_attr2(tree, treeT = c("LT", "DT"), attr1, unit1 = "", attr2,
  unit2 = "", attrC = "", unitC = "", NC = NULL, attrS = "",
  Nbins = c(20, 20), save = FALSE, savePars = list(w = 2500, h = 2000, res
  = 350, path = getwd(), name = "my_dot_attr2"))

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

attr1, attr2

The names of the attributes in the tree, character strings. Each one can be any numeric attribute, as returned from get_attr_names, except for "colony", "generation" and "frame".

unit1, unit2

The units of the corresponding attr, character strings. Each one 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 of each is the empty character "", which implies that the corresponding attr is in arbitrary units.

attrC

The name of the attribute in the tree by which the cells will be colored, a character string. It can be any numeric or boolean attribute, as returned from get_attr_names. Coloring is applied to all depicted cells, except for cells with NA value in this attribute which are colored gray. When the default value "" (the empty character) is used, data points' colors are the default.

unitC

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

NC

Number of colonies in the movie (if attrC = "colony") or number of generations in the movie (if attrC = "generation"), a non-zero positive integer value. This argument is ignored in case attrC != "colony" and attrC != "generation".

attrS

The name of the attribute in the tree by which the cells will be shaped, a character string. It can be any boolean attribute, as returned from get_attr_names. Cells are represented by dots or squares if their value in this attribute is TRUE or FALSE, respectively. When the default value "" (the empty character) is used, data points' shape is the default.

Nbins

Number of equally spaced bins to be used for attr1 and attr2, a vector of two non-zero positive integer values >=2. The first value is used for attr1 and the second for attr2. These values are indicative and may change automatically depending on the values of attr1 and attr2, producing a warning message. The default value is c(20, 20). This argument is ignored in case attrC != "".

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

Details

Each data point (x,y) represents the value of attr1 and attr2 of a cell, respectively. The scatter plot is created for all cells that are included in the analysis, as returned from get_cells, except for cells with NA value in attr1 or attr2.

By default, all data points are dot points colored based on the density of the (X,Y) variable value. 2D binning is applied on the range of all attr1 and attr2 values. Density represents the counts (number of data points) in each bin.

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.


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