Learn R Programming

specmine (version 4.0.0)

umap_scoresplot3D: UMAP 3D scores plot

Description

Creates an interactive three-dimensional scores plot from a UMAP result.

Usage

umap_scoresplot3D(
  dataset,
  umap.result,
  column.class = NULL,
  dims = c(1, 2, 3),
  title = "UMAP 3D Scores Plot"
)

Value

A plotly htmlwidget.

Arguments

dataset

Dataset used to calculate the embedding.

umap.result

Result returned by umap_analysis_dataset().

column.class

Optional metadata column used to colour samples.

dims

Three embedding dimensions to plot.

title

Plot title.

Examples

Run this code
# \donttest{
if (requireNamespace("uwot", quietly = TRUE) &&
    requireNamespace("plotly", quietly = TRUE)) {
  datamat <- matrix(rnorm(40), nrow = 5)
  dataset <- list(
    data = datamat,
    metadata = data.frame(
      class = factor(rep(c("A", "B"), length.out = 8))
    )
  )
  result <- umap_analysis_dataset(
    dataset,
    n_components = 3,
    n_neighbors = 3
  )
  umap_scoresplot3D(dataset, result, column.class = "class")
}
# }

Run the code above in your browser using DataLab