overlap.plot | R Documentation |
Plots the posterior distribution of the niche region overlap metric calculated for each pairwise combination of species.
overlap.plot(
over.stat,
nbreaks = 50,
equal.axis = FALSE,
species.names,
col,
mean.cred = TRUE,
mean.cred.col = "green",
xlab
)
over.stat |
An array with |
nbreaks |
Number of breaks in the histogram. Defaults to 50. |
equal.axis |
Logical. If |
species.names |
A vector of species names. Defaults to |
col |
A vector of the colours in which each species will be drawn. |
mean.cred |
Logical. If |
mean.cred.col |
Colour of the mean and credible interval lines in the histogram. |
xlab |
Optional plot title, located on the bottom. Default is no title. |
This function uses the overlap metric information in over.stat
calculated by overlap()
to create 2-dimensional plots of interspecific niche region overlap.
Returns a series of histograms illustrating the probability of pairwise species overlap.
overlap()
, niw.post()
, niiw.post()
.
# fish data
data(fish)
# parameter draws from the "default" posteriors of each fish
nsamples <- 500
system.time({
fish.par <- tapply(1:nrow(fish), fish$species,
function(ii) niw.post(nsamples = nsamples,
X = fish[ii,2:4]))
})
# overlap calculation
system.time({
over <- overlap(fish.par, nreps = nsamples, nprob = nsamples,
alpha = c(.95, .99))
})
# overlap plot
clrs <- c("black", "red", "blue", "orange") # color for each species
ii <- 1 # which niche region alpha level to use
overlap.plot(over[,,,ii], col = clrs, mean.cred.col = "turquoise",
xlab = paste0("Overlap Probability (%) -- Niche Region Size: ",
dimnames(over)[[4]][ii]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.