lmwLoading2dPlot: Loading plots on a 2D scatter plot

View source: R/lmwLoading2dPlot.R

lmwLoading2dPlotR Documentation

Loading plots on a 2D scatter plot

Description

Draws the Loading plots of each effect matrix provided in lmwPcaEffects outputs. As a wrapper of the plotScatter function, it allows the visualization of effect loading matrices for two components at a time with all options available in plotScatter.

Usage

lmwLoading2dPlot(
  resLmwPcaEffects,
  effectNames = NULL,
  axes = c(1, 2),
  metadata = NULL,
  ...
)

Arguments

resLmwPcaEffects

A list corresponding to the output value of lmwPcaEffects.

effectNames

Names of the effects to be plotted. If NULL, all the effects are plotted.

axes

A numerical vector with the 2 Principal Components axes to be drawn.

metadata

A nxk "free encoded" data.frame corresponding to design in plotScatter.

...

Additional arguments to be passed to plotScatter.

Details

lmwLoading2dPlot is a wrapper of plotScatter.

Value

A list of loading plots (ggplot).

Examples


data('UCH')
resLmwModelMatrix = lmwModelMatrix(UCH)
resLmwEffectMatrices = lmwEffectMatrices(resLmwModelMatrix)
resASCA = lmwPcaEffects(resLmwEffectMatrices)

# adding labels to points
labels = substr(colnames(UCH$outcomes),1,4)
ids <- order(resASCA$Hippurate$loadings[,1], decreasing = TRUE)[1:10]
labels[-c(ids)] <- ""

# adding (arbitrary) color and shape to points
groups <- rep(c(1,2), length.out = ncol(UCH$outcomes))
metadata <- data.frame(groups)

lmwLoading2dPlot(resASCA,effectNames = "Hippurate",
metadata = metadata, color = "groups", shape = "groups",
points_labs = labels)

bgovaerts/LMWiRe documentation built on Sept. 17, 2022, 12:32 a.m.