Skip to contents

Plot a sample embedding

Usage

plot_embedding(
  embedding,
  sample_data = NULL,
  axes = c(1L, 2L),
  colour = NULL,
  shape = NULL,
  label = NULL
)

Arguments

embedding

A prcomp object, limma MDS object, sample-by-dimension matrix, or Rtsne result.

sample_data

Optional sample metadata with unique sample row names matching the embedding exactly.

axes

Two one-based embedding dimensions.

colour, shape, label

Optional column names in sample_data mapped to colour, shape, and text labels. Shape values must be discrete. The default discrete colour scale supports up to eight levels; for more levels, replace it with a standard ggplot2 colour scale before drawing or building.

Value

An unprinted standard ggplot object carrying recommended physical dimensions for plot_save().