plotBars
plotBars |
R Documentation |
Plot a barplot using ggplot2
Description
Plot a ggplot2 barplot from a matrix or data frame. The data should be in tabular format (e.g. features in rows and samples in columns).
Usage
plotBars(
data,
label_x = "Samples",
label_y = "Abundances",
label_fill = "Features",
color = NULL,
base_size = 11,
max_scale_value = NULL,
metadata_groups = NULL
)
Arguments
|
Numeric matrix or data frame. |
|
character Label for the x axis (default
|
|
character Label for the y axis (default
|
|
character Label for color categories (default
|
|
Vector with custom colors for the different
features. If empty, the default ggplot2
palette will be used (default |
|
numeric. Base font size (default |
|
numeric. Maximum value to include in the y
axis. By default it is handled automatically
by ggplot2 (default |
|
list. Split the plot into groups defined by
the user: list(‘G1’ = c(‘sample1’, sample2’),
‘G2’ = c(‘sample3’, ‘sample4’)) default
|
Value
a ggplot2 plot object.
See Also
plotTaxonomy for plotting the most abundant taxa of a SQM object;
plotHeatmap for plotting a heatmap with arbitrary data;
mostAbundant for selecting the most abundant rows in a dataframe
or matrix.
Examples
data(Hadza)
sk = Hadza$taxa$superkingdom$abund
plotBars(sk, label_y = "Raw reads", label_fill = "Superkingdom")