plot_comm_div: Plot alpha-, beta-, and gamma-scale biodiversity statistics...

View source: R/mobr_boxplots.R

plot_comm_divR Documentation

Plot alpha-, beta-, and gamma-scale biodiversity statistics for a MoB analysis

Description

Plots the community diversity metrics from produced by the function calc_comm_div. The p-value for each statistic is displayed in the plot title if applicable.

Usage

plot_comm_div(
  comm_div,
  index = NULL,
  multi_panel = FALSE,
  col = c("#FFB3B5", "#78D3EC", "#6BDABD", "#C5C0FE", "#E2C288", "#F7B0E6", "#AAD28C"),
  cex.axis = 1.2,
  ...
)

Arguments

comm_div

a table that is output by calc_comm_div that has the sample (alpha) and group (gamma) level statistics

index

The biodiversity statistics that should be plotted. See calc_comm_div for information on the indices. By default there is one figure for each index, with panels for alpha- and gamma-scale results as well as for beta-diversity when applicable.

multi_panel

A logical variable. If multi_panel = TRUE then a multipanel plot is produced, which shows observed, rarefied, and asymptotic species richness and S_PIE at the alpha- and gamma-scale. This set of variables conveys a comprehensive picture of the underlying biodiversity changes.

col

a vector of colors for the groups, set to NA if no color is preferred

cex.axis

The magnification to be used for axis annotation relative to the current setting of cex. Defaults to 1.2.

...

additional arguments to provide to boxplot, points, and confidence interval functions

Details

The user may specify which results to plot or simply to plot all the results.

Author(s)

Felix May, Xiao Xiao, and Dan McGlinn

Examples

library(dplyr)
data(tank_comm)
data(tank_plot_attr)
indices <- c('N', 'S', 'S_C', 'S_n', 'S_PIE')
tank_div <- tibble(tank_comm) |> 
  group_by(group = tank_plot_attr$group) |> 
  group_modify(~ calc_comm_div(.x, index = indices, effort = 5,
                               extrapolate = TRUE))
# plot the community metrics                                 
plot_comm_div(tank_div, index = "S")
plot_comm_div(tank_div, index = "S_n")
# or plot all of the indices at once with
plot_comm_div(tank_div)

MoBiodiv/mobr documentation built on Oct. 26, 2024, 10:51 a.m.