Learn R Programming

specmine (version 4.0.0)

ica_scoresplot2D: ICA 2D scores plot

Description

Creates a two-dimensional scores plot from an ICA result.

Usage

ica_scoresplot2D(
  dataset,
  ica.result,
  column.class = NULL,
  dims = c(1, 2),
  labels = FALSE,
  ellipses = FALSE,
  bw = FALSE,
  palette = 2,
  leg.pos = "right",
  xlim = NULL,
  ylim = NULL
)

Value

A ggplot object.

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 or group samples.

dims

Two independent components to plot.

labels

Logical indicating whether sample labels should be displayed.

ellipses

Logical indicating whether group ellipses should be displayed.

bw

Logical indicating whether a black-and-white plot should be used.

palette

RColorBrewer palette number.

leg.pos

Legend position.

xlim

Optional x-axis limits.

ylim

Optional y-axis limits.

Examples

Run this code
if (requireNamespace("fastICA", 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 = 2,
    maxit = 100,
    seed = 42
  )

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

Run the code above in your browser using DataLab