addLink: Add a link on a compositional plot

View source: R/addLink.R

addLinkR Documentation

Add a link on a compositional plot

Description

Add a link on a compositional plot

Usage

addLink(
  DIplot,
  links,
  Views,
  samples,
  variable = NULL,
  Dims = c(1, 2),
  addLabel = FALSE,
  labPos = NULL,
  projColour = "grey",
  latentSize = 0.25
)

Arguments

DIplot

A list with ggplot object where the links are to be added, and data frames with coordinates (obtained by setting plot(..., returnCoords = TRUE))

links

A matrix containing either feature names (two column matrix) or approximate coordinates (four column matrix)

Views

Indices or names of the views for which the links should be added

samples

Sample names or approximate sample coordinates

variable

Name of variable in environmental gradient for which link should be plotted

Dims

vector of length 2 referring to the model dimensions

addLabel

A boolean, should arrow with label be plotted?

labPos

The position of the label, as a numeric vector of length 2

projColour

The colour of the projection, as character string

latentSize

Size of the line from the origin to the latent variable dot

Value

A ggplot object with the links added

Examples

data(Zhang)
## Not run: 
#Unconstrained
microMetaboInt = combi(
list("microbiome" = zhangMicrobio, "metabolomics" = zhangMetabo),
distributions = c("quasi", "gaussian"), compositional = c(TRUE, FALSE),
logTransformGaussian = FALSE, verbose = TRUE)

## End(Not run)
load(system.file("extdata", "zhangFits.RData", package = "combi"))
Plot = plot(microMetaboInt, samDf = zhangMetavars, samCol = "ABX",
 returnCoords = TRUE)
addLink(Plot, links = cbind("OTU0565b3","OTUa14fb5"), Views = 1,
 samples = c(1,1))

CenterForStatistics-UGent/combi documentation built on Aug. 22, 2023, 11:02 p.m.