diffplot: Plot Compositional Differences

Description Usage Arguments Details Examples

View source: R/diffplot.R

Description

Make a plot showing differences and p-values.

Usage

1
2
  diffplot(comptab, vars = c("ZC", "nH2O"), col = "black",
           plot.rect = FALSE, pt.text = c(letters, LETTERS))

Arguments

comptab

list or data frame, summary of comparisons generated by get_comptab

vars

character, which variables to plot

col

the color(s) for points

plot.rect

plot a reference rectangle?

pt.text

text labels for the points

Details

A plot is created with points showing the differences in medians or means of two compositional metrics. The default setting of vars refers to average oxidation state of carbon (\ZC) as the x-variable and water demand per residue in formation reactions from basis species (\nH2O&#772) as the y-variable.

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.

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 emphasizing the different scales of adjacent plots.

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

Examples

1
2
3
4
5
6
library(CHNOSZ)
comptab <- lapply(c("JKMF10", "WDO+15_C.N"), function(dataset) {
  pdat <- get_pdat(dataset)
  get_comptab(pdat)
})
diffplot(comptab)

canprot documentation built on Feb. 27, 2019, 1:10 a.m.