Learn R Programming

specmine (version 4.0.0)

umap_scoresplot2D: UMAP 2D scores plot

Description

Creates a two-dimensional scores plot from a UMAP result.

Usage

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

Value

A ggplot object.

Arguments

dataset

Dataset used to calculate the embedding.

umap.result

Result returned by umap_analysis_dataset().

column.class

Optional metadata column used to colour or group samples.

dims

Two embedding dimensions 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.

pallette

RColorBrewer palette number.

leg.pos

Legend position.

xlim

Optional x-axis limits.

ylim

Optional y-axis limits.

Examples

Run this code
# \donttest{
if (requireNamespace("uwot", 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_neighbors = 3)
  umap_scoresplot2D(dataset, result, column.class = "class")
}
# }

Run the code above in your browser using DataLab