| hill_bar_pq | R Documentation |
For each Hill diversity order in q, draws a bar at the group mean (±1 SE)
with jittered individual points. A Kruskal-Wallis test is reported in the
subtitle; when the global effect is significant, Tukey HSD pairwise
comparisons produce compact letter displays above the bars. Multiple values
of q are assembled into a patchwork layout automatically.
hill_bar_pq(
physeq,
x,
q = c(0, 2),
fill,
x_lab = NULL,
y_labs = NULL,
ncol = NULL,
alpha = 0.6,
point_size = 3,
base_size = 13,
jitter_width = 0.15,
bar_width = 0.7,
add_letters = TRUE,
p_threshold = 0.05,
letter_size = 5,
letters_top_offset = 0.05,
y_lab_size = NULL,
x_lab_size = NULL,
show_n_samples = TRUE,
palette = c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00",
"#CC79A7", "#000000"),
error_fun = function(x) {
m <- mean(x, na.rm = TRUE)
se <- sd(x, na.rm =
TRUE)/sqrt(sum(!is.na(x)))
c(lower = m - se, upper = m + se)
},
error_fun_lab = "mean ± SE",
error_bar_alpha = 0.35,
point_alpha = 0.5,
letters_below_bar = FALSE,
...
)
physeq |
(required) a |
x |
Name (unquoted) of the grouping variable in |
q |
Numeric vector of Hill diversity orders to plot. The corresponding
|
fill |
Name (unquoted) of the fill aesthetic column. Defaults to |
x_lab |
Label for the x-axis. Defaults to the column name of |
y_labs |
Named character vector of y-axis labels keyed by |
ncol |
Number of columns in the patchwork layout when |
alpha |
Transparency of bars. Default |
point_size |
Size of jittered points. Default |
base_size |
Base font size in pts. Default |
jitter_width |
Horizontal jitter width. Default |
bar_width |
Width of bars. Default |
add_letters |
Logical. Add compact letter display above bars.
Requires the multcompView package. Default |
p_threshold |
Significance threshold for the Kruskal-Wallis test.
Below this value, Tukey HSD pairwise comparisons are run and letters
assigned; above it all groups receive |
letter_size |
Size of letter labels in ggplot2 units. Default |
letters_top_offset |
Fraction of the y-range added above the highest
point / error-bar to position letters. Default |
y_lab_size |
Size of y-axis tick labels in pts. Defaults to |
x_lab_size |
Size of x-axis tick labels in pts. Defaults to |
show_n_samples |
Logical. If |
palette |
Character vector of fill colours. Defaults to the Okabe-Ito palette. |
error_fun |
Function taking a numeric vector and returning a 2-element
numeric vector |
error_fun_lab |
Label for the error bar used in the plot caption.
Default |
error_bar_alpha |
Transparency of the secondary top-half error bar
drawn over the jittered points to hint at the upper extent without
obscuring data. Default |
point_alpha |
Transparency of the jittered data points. Default |
letters_below_bar |
Logical. When |
... |
Additional arguments passed to |
A ggplot object when length(q) == 1, or a patchwork object
when length(q) > 1.
Adrien Taudière
hill_pq(), psmelt_samples_pq(), ggbetween_pq()
hill_bar_pq(data_fungi_mini, Height, q = 1)
## Not run:
hill_bar_pq(data_fungi_mini, Height, q = 0)
hill_bar_pq(data_fungi_mini, Height, q = c(0, 1, 2), ncol = 1)
hill_bar_pq(data_fungi_mini, Height,
q = c(0, 2),
y_labs = c(Hill_0 = "Richness", Hill_2 = "Simpson diversity")
)
hill_bar_pq(data_fungi_mini, Height, add_letters = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.