
Plot counts of feature annotation rows by category, optionally split by a second categorical column, with plot_ly()
Source: R/barplot.R
interactive_count_barplot.RdTallies a categorical column from a feature annotation table (e.g.
mcols()/rowData() of a SummarizedExperiment, or the
data frame returned by the selectmatrix module's
getAnnotation()) and renders the counts as a bar chart via
interactive_barchart. Generalises the shape of the
differential-expression-by-biotype plot rendered by the
nf-core/differentialabundance report to any categorical annotation column.
Usage
interactive_count_barplot(
annotation,
category,
fill = NULL,
barmode = c("group", "stack"),
palette_name = COLORBLIND_PALETTE_NAME,
title = NULL
)Arguments
- annotation
A data frame of feature annotation, one row per feature.
- category
Name of a column in
annotationto count rows by; forms the plot's x axis.- fill
Optional name of a second column in
annotationto split counts by (bar colour/legend). DefaultNULL: a single, unsplit count per category.- barmode
Bar mode when
fillis specified:"group"(dodged bars, the default) or"stack".- palette_name
Valid R color palette name
- title
Plot title
Examples
interactive_count_barplot(
data.frame(
biotype = c("protein_coding", "protein_coding", "lncRNA", "lncRNA"),
direction = c("Up", "Down", "Up", "Up")
),
category = "biotype", fill = "direction"
)