diffplot {canprot}R Documentation

Plot Compositional Differences

Description

Make a plot showing differences of selected compositional metrics.

Usage

  diffplot(comptab, vars = c("ZC", "nH2O"), col = "black", plot.rect = FALSE,
           pt.text = c(letters, LETTERS), cex.text = 0.85, oldstyle = FALSE,
           pch = 1, cex = 2.1, contour = TRUE, col.contour = par("fg"),
           probs = 0.5, add = FALSE, labtext = NULL, ...)
  cplab

Arguments

comptab

list or data frame, compositional differences generated by get_comptab

vars

character, which variables to plot

col

character or numeric, color(s) for the points

plot.rect

logical, plot a reference rectangle?

pt.text

character, text labels for the points

cex.text

numeric, size of text labels

oldstyle

logical, use old style plot?

pch

numeric, point symbol

cex

numeric, point size

contour

logical, add contour lines?

col.contour

character or numeric, color of contour lines

probs

numeric, probability level(s) for contours

add

logical, add to an existing plot?

labtext

character, text to add to axis labels

...

other argumenents passed to plot

Details

A plot is created with points showing the differences between up- and down-regulated proteins for two compositional metrics, as calculated by get_comptab. The default setting of vars refers to average oxidation state of carbon (ZC) as the x-variable and stoichiometric hydration state (nH2O) as the y-variable.

The colors of the points are controlled by col, which is recycled to be equal to the number of comparisons in comptab.

If plot.rect is TRUE, a shaded rectangle is drawn with coordinates -0.01, -0.01, 0.01, 0.01. This is useful for visualizing the different scales of multi-panel plots.

If pt.text is not NA or FALSE, text labels are added with size controlled by cex.text. The default value produces labels that are taken sequentially from the 26 lowercase Roman letters in alphabetical order (letters), followed by the set of uppercase letters (LETTERS).

For labtext = NULL, descriptive text (“median difference” or “mean difference”) is added to the axis labels in parentheses. This text can be changed by giving a value in labtext (for both axes), two values (for each axis), or NA to suppress the text.

cplab is a list of formatted labels used by diffplot. It is an exported object, available to the user and other packages.

Plot style

The overall style of the plot is controlled by oldstyle.

oldstyle = FALSE

This is the current default style. Use pch and cex to control the point symbol and size. Contours are added for confidence regions of highest probability density, computed using a 2-D kernel density estimate (kde2d). probs gives the probability level(s) and col.contour sets the color(s) of the contour lines. contour can be a logical vector, indicating which points to include; set it to FALSE to omit the contour lines.

The code to calculate the contour levels is modified from HPDregionplot in the emdbook package by Ben Bolker (https://cran.r-project.org/package=emdbook).

oldstyle = TRUE

This style was used for the historical (2017) vignettes, which have been moved to the extdata/cpcp directory in JMDplots (https://github.com/jedick/JMDplots). For each dataset, the point symbol is a filled square if the p-values of both the x-variable and y-variable are less than 0.05, a filled circle if the p-value of one of the x- or y-variables is less than 0.05, and an open circle otherwise. A solid line is drawn from the point to the corresponding axis if the rounded, absolute value of (CLES in percent - 50) of the x- or y-variable is greater than or equal 10. Otherwise, a dashed line is drawn from the point to the corresponding axis if the p-value of the x- or y-variable is less than 0.05. Otherwise, no line is drawn.

See Also

qdist to plot quantile distributions for a single dataset.

Examples

library(CHNOSZ)
# Make an old-style plot for two datasets
comptab <- lapply(c("JKMF10", "WDO+15_C.N"), function(dataset) {
  pdat <- pdat_colorectal(dataset)
  get_comptab(pdat, oldstyle = TRUE)
})
diffplot(comptab, oldstyle = TRUE)

[Package canprot version 1.1.0 Index]