plotPARAFACmodel {parafac4microbiome} | R Documentation |
Plot a PARAFAC model
Description
Plot a PARAFAC model
Usage
plotPARAFACmodel(
model,
dataset,
numComponents,
colourCols = NULL,
legendTitles = NULL,
xLabels = NULL,
legendColNums = NULL,
arrangeModes = NULL,
continuousModes = NULL,
overallTitle = ""
)
Arguments
model |
Model output from |
dataset |
A longitudinal microbiome dataset, ideally processed with
|
numComponents |
Number of PARAFAC components in the model. |
colourCols |
Vector of strings stating which column names should be factorized for colours per mode. |
legendTitles |
Vector of strings stating the legend title per mode. |
xLabels |
Vector of strings stating the x-axis labels per mode. |
legendColNums |
Vector of integers stating the desired number of columns for the legends per mode. |
arrangeModes |
Vector of boolean values per mode, stating if the loadings should be arranged according to colourCols (TRUE) or not (FALSE). |
continuousModes |
Vector of boolean values per mode, stating if the loadings should be plotted as a line plot (TRUE) or a bar plot (FALSE). |
overallTitle |
Overall title of the plot. |
Value
Plot object
Examples
library(multiway)
library(dplyr)
library(ggplot2)
set.seed(0)
# Process the data
processedFujita = processDataCube(Fujita2023, sparsityThreshold=0.9, centerMode=1, scaleMode=2)
# Make PARAFAC model
model = parafac(processedFujita$data, nfac=2, nstart=10, verbose=FALSE)
# Make plot
plotPARAFACmodel(model, processedFujita,
numComponents = 2,
colourCols = c("", "Genus", ""),
legendTitles = c("", "Genus", ""),
xLabels = c("Replicate", "Feature index", "Time point"),
legendColNums = c(0,5,0),
arrangeModes = c(FALSE, TRUE, FALSE),
continuousModes = c(FALSE,FALSE,TRUE),
overallTitle = "Fujita PARAFAC model")