View source: R/plot_specificities.r
plot_specs_violin | R Documentation |
Visualizes results from phy_or_env_spec as violins. Violin area is proportionally divided such that lighter colors represent density of non-significant features, and darker colors represent statistically significant features.
plot_specs_violin(
specs_list,
cols = "black",
cols_bord = "white",
alpha = 0.05,
label_cex = 1,
nsig_trans = 0.3,
minval = -1,
maxval = 1,
ylab = "Spec",
...
)
specs_list |
list of data.frames. Each data.frame must be an output from phy_or_env_spec; must have columns "Spec" and "Pval". |
cols |
character vector of color names or hex codes. If only one value is given, all violins will be that color. Otherwise, one value may be given per item in specs_list, corresponding to its order (default: "black"). |
cols_bord |
character vector of color names or hex codes. Color name or hex code for borders drawn around and within violins. Length 1 or length n, just like cols. For no borders, use cols_bord=NA (default: "white"). |
alpha |
float. alpha value for determining statistical significance (default: 0.05). |
label_cex |
float. Used to change size of x-axis labels (default: 1). |
nsig_trans |
float between 0 and 1 (inclusive). Determines how transparent violin area will be for nonsignificant features, with 0 meaning totally transparent and 1 meaning totally opaque (default: 0.4). |
minval |
minimum possible value for specificity statistic (default: -1). |
maxval |
maximum possible value for specificity statistic (default: 1). |
ylab |
y-axis label for plot (default:"Spec"). |
... |
additional arguments to be passed to polygon(). |
returns nothing (a plot is made).
John L. Darcy
# 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",
# denom_type="sim_center")
# specs_list$Evapotranspiration <- phy_or_env_spec(m,
# env=metadata$Evapotranspiration, n_cores=10,
# n_sim=100, p_method="gamma_fit",
# denom_type="sim_center")
# specs_list$Rainfall <- phy_or_env_spec(m, env=metadata$Rainfall,
# n_cores=10, n_sim=50, p_method="gamma_fit",
# denom_type="sim_center")
# # default black
# plot_specs_violin(specs_list)
# # with colors
# plot_specs_violin(specs_list, cols=c("forestgreen", "gold", "blue"))
# # with border colors
# plot_specs_violin(specs_list, cols=c("forestgreen", "gold", "blue"),
# cols_bord=c("red", "blue", "black"))
# # with thicker borders (arg "lwd" is passed to polygon())
# plot_specs_violin(specs_list, cols=c("forestgreen", "gold", "blue"),
# cols_bord="black", lwd=3)
# # with NO borders
# plot_specs_violin(specs_list, cols=c("forestgreen", "gold", "blue"),
# cols_bord=NA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.