View source: R/plot_functions.R
| tax_bar_pq | R Documentation |
Graphical representation of distribution of taxonomy, optionnaly across a factor.
tax_bar_pq(
physeq,
fact = "Sample",
taxa = "Order",
percent_bar = FALSE,
nb_seq = TRUE,
add_ribbon = FALSE,
ribbon_alpha = 0.3,
label_taxa = FALSE,
void_theme = TRUE,
show_values = FALSE,
minimum_value_to_show = 0,
label_size = 3.2,
value_size = 3,
top_label_size = 3.2,
bar_width = NULL,
bar_internal_color = NA,
linewidth_bar_internal = ifelse(is.na(bar_internal_color), 0, 0.5),
show_n_samples = TRUE,
n_sample_text_size = 3
)
physeq |
(required) a |
fact |
Name of the factor to cluster samples by modalities.
Need to be in |
taxa |
(default: 'Order') Name of the taxonomic rank of interest |
percent_bar |
(default FALSE) If TRUE, the stacked bar fill all
the space between 0 and 1. It just set position = "fill" in the
|
nb_seq |
(logical; default TRUE) If set to FALSE, only the number of ASV is count. Concretely, physeq otu_table is transformed in a binary otu_table (each value different from zero is set to one) |
add_ribbon |
(logical; default FALSE) If TRUE and |
ribbon_alpha |
(numeric; default 0.3) Transparency of the ribbons. |
label_taxa |
(logical; default FALSE) If TRUE, replace the legend with direct labels on the right side of the last bar. Taxa that appear in the first bar but are absent from the last bar are additionally labelled on the left side of the first bar. Segments are drawn to resolve overlapping labels. |
void_theme |
(logical; default TRUE) If TRUE, use
|
show_values |
(logical; default FALSE) If TRUE, display
abundance values (or percentages when |
minimum_value_to_show |
(numeric; default 0) When
|
label_size |
(numeric; default 3.2) Font size (in ggplot2 mm
units) for taxa labels when |
value_size |
(numeric; default 3) Font size (in ggplot2 mm
units) for value labels when |
top_label_size |
(numeric; default 3.2) Font size (in ggplot2 mm
units) for the top group labels when |
bar_width |
(numeric; default NULL set 0.9 if |
bar_internal_color |
(default NA) Color of bar borders. Use |
linewidth_bar_internal |
(default 0 if |
show_n_samples |
(logical; default |
n_sample_text_size |
(numeric; default |
A ggplot2 plot with bar representing the
number of sequence en each taxonomic groups
Adrien Taudière
plot_tax_pq() and multitax_bar_pq()
data_fungi_ab <- subset_taxa_pq(
data_fungi_mini,
taxa_sums(data_fungi_mini) > 1000
)
tax_bar_pq(data_fungi_ab) + theme(legend.position = "none")
tax_bar_pq(data_fungi_ab,
taxa = "Class", fact = "Height",
show_n_samples = TRUE
)
tax_bar_pq(data_fungi_ab, taxa = "Class")
tax_bar_pq(data_fungi_ab, taxa = "Class", percent_bar = TRUE)
tax_bar_pq(data_fungi_ab, taxa = "Class", fact = "Time")
tax_bar_pq(data_fungi_ab,
taxa = "Class", fact = "Time",
percent_bar = TRUE, add_ribbon = TRUE
)
tax_bar_pq(data_fungi_ab,
taxa = "Class", fact = "Time",
percent_bar = TRUE, add_ribbon = TRUE, label_taxa = TRUE
)
tax_bar_pq(data_fungi_ab,
taxa = "Class", fact = "Time",
show_values = TRUE, minimum_value_to_show = 10000
)
tax_bar_pq(data_fungi_ab,
fact = "Height", taxa = "Class",
nb_seq = FALSE, percent_bar = TRUE, label_taxa = TRUE,
add_ribbon = TRUE, value_size = 7, ribbon_alpha = .6,
show_values = TRUE, label_size = 4, top_label_size = 6,
minimum_value_to_show = 0.05
) |>
reorder_distinct_colors(alternate_lightness = TRUE)
tax_bar_pq(data_fungi_mini,
fact = "Height", taxa = "Order",
nb_seq = TRUE, percent_bar = TRUE, label_taxa = TRUE,
add_ribbon = TRUE, value_size = 5,
ribbon_alpha = .6, show_values = TRUE,
label_size = 4, top_label_size = 8,
minimum_value_to_show = 0.05, bar_width = NULL,
linewidth_bar_internal = 0.1, bar_internal_color = "black"
) |>
reorder_distinct_colors(alternate_lightness = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.