Learn R Programming

specmine (version 4.0.0)

ica_scoresplot3D: ICA 3D scores plot

Description

Creates an interactive three-dimensional scores plot from an ICA result.

Usage

ica_scoresplot3D(
  dataset,
  ica.result,
  column.class = NULL,
  dims = c(1, 2, 3),
  title = "ICA 3D Scores Plot"
)

Value

A plotly htmlwidget.

Arguments

dataset

Dataset used to calculate the independent components.

ica.result

Result returned by ica_analysis_dataset().

column.class

Optional metadata column used to colour samples.

dims

Three independent components to plot.

title

Plot title.

Examples

Run this code
if (requireNamespace("fastICA", quietly = TRUE) &&
    requireNamespace("plotly", quietly = TRUE)) {
  datamat <- matrix(rnorm(240), nrow = 8)
  dataset <- list(
    data = datamat,
    metadata = data.frame(
      class = factor(rep(c("A", "B"), each = 15))
    )
  )

  ica.result <- ica_analysis_dataset(
    dataset,
    n_components = 3,
    maxit = 100,
    seed = 42
  )

  ica_scoresplot3D(
    dataset,
    ica.result,
    column.class = "class"
  )
}

Run the code above in your browser using DataLab