alluvialplot: Create an alluvial plot from long categorical data

View source: R/helperfunctions.R

alluvialplotR Documentation

Create an alluvial plot from long categorical data

Description

Wrapper around ggalluvium package for ggplot based alluvial plot, for quickly making alluvial plot from "long", "raw" categorical data (such as Seurat object meta.data), rather than two-way counts of categories.

Usage

alluvialplot(labelsdf, repel, nudge_x, ggfittext, ...)

Arguments

labelsdf

data.frame with two columns of raw categorical label: for example, each row is a cell (or other observation), and each column is metadata column 1 and metadata column 2

repel

T/F, whether to repel the labels, default = T

nudge_x

numeric, default nudge to the left and right of the repel labels, default 0.2

ggfittext

T/F - whether to use ggfittext, to try to squeeze or remove tiny stratum labels

...

Value

a ggplot object

Examples

#labelsdf can look like this, row.names of cells not needed,
# just two columns of categorical data as a data.frame:
                     From      To
AACCCAAGCATGCGA-1    Malignant  2
AAACCCAAGTAGGTTA-1    Malignant  2
AAACCCACAAAGCACG-1   Neutrophil  0
AAACCCACAGCAGTAG-1    Malignant  2
AAACCCACATACCGTA-1    Malignant  2

FerrenaAlexander/FerrenaSCRNAseq documentation built on March 10, 2023, 9:31 a.m.