trophicDensityPlot: Function to plot posterior samples of trophic position...

trophicDensityPlotR Documentation

Function to plot posterior samples of trophic position estimates

Description

This function receives a data frame with sampled posterior trophic position estimates. The user may set if he/she wants quantiles to be plotted, in which case the 95 can states whether he/she wants the density plots grouped or not. For visualization purposes, density functions look better if they are not grouped, when quantiles are added.

Usage

trophicDensityPlot(df = NULL, quantiles = FALSE, grouped = TRUE)

Arguments

df

data frame with 2 variables: "TP" and "Species". TP can be posterior samples of trophic position and Species must be a factor.

quantiles

logical variable. If TRUE 95 distribution, plus mean and median are added to the plot.

grouped

logical variable. If TRUE trophic position density plots are grouped.

Value

a ggplot2::ggplot object

Examples

species1 <- stats::rnorm(1000, 4, 0.1)
species2 <- stats::rnorm(1000, 3, 0.8)
TP <- c(species1, species2)
Species <- c(rep("Species 1", length(species1)),
rep("Species 2", length(species2)))
df <- data.frame(TP, Species)
trophicDensityPlot(df)

AndrewLJackson/tRophicPosition documentation built on Jan. 2, 2023, 12:14 p.m.