Generate a bar plot of frequencies for taxonomic ranks
Usage
barplot_freq(
data,
sort_by = c("freq", "name"),
decreasing = TRUE,
flip = TRUE,
limit_freq = NULL,
top = NULL,
bar_color = "steelblue",
show_n = FALSE,
label_color = "white",
...
)Arguments
- data
A data frame or tibble containing the frequency data of the taxonomic rank
- sort_by
Character vector specifying the sorting criteria for the bars. Default is "freq". Valid options are "freq" and "name".
- decreasing
Logical indicating whether to sort the bars in decreasing order. Default is TRUE.
- flip
Logical indicating whether to flip the orientation of the plot. Default is TRUE.
- limit_freq
Numeric value specifying the minimum frequency threshold for including a taxa in the plot. Default is NULL, which includes all taxa.
- top
Numeric value specifying the maximum number of taxa to include in the plot. Default is NULL, which includes all taxa.
- bar_color
Color of the bars. Default is "steelblue".
- show_n
Logical indicating whether to display the records number over the bar. Default is FALSE.
- label_color
Color of the labels. Default is "white".
- ...
Additional arguments to be passed to
ggplot2()and related functions.