biplot_corral: Generate biplot for corral object

View source: R/plot_embedding.R

biplot_corralR Documentation

Generate biplot for corral object

Description

Generate biplot for corral object

Usage

biplot_corral(
  corral_obj,
  color_vec,
  text_vec,
  feat_name = "(genes)",
  nfeat = 20,
  xpc = 1,
  plot_title = "Biplot",
  text_size = 2,
  xjitter = 0.005,
  yjitter = 0.005,
  coords = c("svd", "PC", "SC")
)

Arguments

corral_obj

list outputted by the corral function

color_vec

vector; length should correspond to the number of rows in v of corral_obj, and each element of the vector classifies that cell (entry) in the embedding to that particular class, which will be colored the same. (e.g., cell type)

text_vec

vector; length should correspond to the number of rows in u of corral_obj, and each element of the vector is the label for the respective feature that would show on the biplot.

feat_name

char; the label will in the legend. Defaults to (genes).

nfeat

int; the number of features to include. The function will first order them by distance from origin in the selected dimensions, then select the top n to be displayed.

xpc

int; which PC to put on the x-axis (defaults to 1)

plot_title

char; title of plot (defaults to *Biplot*)

text_size

numeric; size of the feature labels given in text_vec (defaults to 2; for ggplot2)

xjitter

numeric; the amount of jitter for the text labels in x direction (defaults to .005; for ggplot2)

yjitter

numeric; the amount of jitter for the text labels in y direction (defaults to .005; for ggplot2)

coords

char; indicator for sets of coordinates to use. svd plots the left and right singular vectors as outputted by SVD (u and v), which PC and SC use the principal and standard coordinates, respectively (defaults to svd)

Value

ggplot2 object of the biplot

Examples

library(DuoClustering2018)
library(SingleCellExperiment)
zm4eq.sce <- sce_full_Zhengmix4eq()
zm4eq.countmat <- counts(zm4eq.sce)
zm4eq.corral_obj <- corral(zm4eq.countmat)
gene_names <- rowData(zm4eq.sce)$symbol
ctvec <- zm4eq.sce$phenoid

biplot_corral(corral_obj = zm4eq.corral_obj, color_vec = ctvec, text_vec = gene_names)

laurenhsu1/corral documentation built on Feb. 19, 2023, 10:37 p.m.