plot_pairwise_spec: plot_pairwise_spec

View source: R/plot_pairwise_spec.r

plot_pairwise_specR Documentation

plot_pairwise_spec

Description

Plots pairwise correlations between specificity to multiple variables. Specificity results are supplied to this function as a list of specificity tables, i.e. a list where each object within the list is an output of phy_or_env_spec, and all were created using the same abunds_mat object (see: ?phy_or_env_spec).

Usage

plot_pairwise_spec(
  sl,
  label_cex = 1,
  point_cex = 1,
  cor_cex = 2,
  cor_red_lim = 0.7,
  method = "pearson"
)

Arguments

sl

"specs list" list of outputs from phy_or_env_spec as described above.

label_cex

float. Size of variable labels, which will be displayed along the plot's diagonal. Use cex units; see ?par (default: 1).

point_cex

float. Size of points in the plot's lower triangle. Useful to reduce this if you are plotting lots of species. Use cex units; see ?par (default: 1).

cor_cex

float. Size of text for correlations displayed in plot's upper triangle. Use cex units; see ?par (default: 1).

cor_red_lim

float. Correlation coefficients will be shown in red if they are equal to or more extreme than this value (default: 0.70).

method

string. Preferred correlation method. see ?cor for options (default: "pearson").

Value

Returns nothing. Plots correlations in a square matrix of subplots, where variable names are shown in the diagonal, pairwise specificities are plotted in the lower triangle, and correlation coefficients are displayed in the upper triangle. For plots in the lower triangle, each point represents a species.

Author(s)

John L. Darcy

Examples

# library(specificity)
# attach(endophyte)
# # only analyze species with occupancy >= 20
# m <- occ_threshold(prop_abund(otutable), 20)
# # create list to hold phy_or_env_spec outputs
# specs_list <- list()
# specs_list$NDVI <- phy_or_env_spec(m, env=metadata$NDVI, 
#   n_cores=10, n_sim=50, p_method="gamma_fit")
# specs_list$Evapotranspiration <- phy_or_env_spec(m,
#   env=metadata$Evapotranspiration, n_cores=10, 
#   n_sim=100, p_method="gamma_fit")
# specs_list$Rainfall <- phy_or_env_spec(m, env=metadata$Rainfall,
#   n_cores=10, n_sim=50, p_method="gamma_fit")
# plot_pairwise_spec(specs_list)


darcyj/specificity documentation built on Aug. 1, 2023, 8 a.m.