Graph_boxplots: Box and Whiskers Plot for Tracers

View source: R/Graph_Boxplots.R

Graph_boxplotsR Documentation

Box and Whiskers Plot for Tracers

Description

Visualizes the distribution of continuous tracer variables across sources and mixtures. It displays summary statistics (median, hinges, whiskers) alongside individual outliers.

Usage

Graph_boxplots(
  data,
  tracers = 1:(ncol(data) - 2),
  ncol = 3,
  colors = NULL,
  seed = NULL
)

boxPlot(
  data,
  tracers = 1:(ncol(data) - 2),
  ncol = 3,
  colors = NULL,
  seed = NULL
)

box_plot(
  data,
  tracers = 1:(ncol(data) - 2),
  ncol = 3,
  colors = NULL,
  seed = NULL
)

Arguments

data

Data frame containing source and mixture data in the standard format.

tracers

Numeric vector. Indices of the tracers to plot (1 refers to the first tracer column). Default is 1 to (ncol(data) - 2).

ncol

Integer. Number of plot columns per row in the grid layout. Default is 3.

colors

Character vector. Optional hex codes or color names for custom boxplot colors. Default is NULL.

seed

Integer. Random seed for reproducible jittering or sampling. Default is NULL.

Value

Invisibly returns the combined plot grid object created by gridExtra::grid.arrange().

Examples

data <- data.frame(
   ID = paste0("S", 1:12),
   Group = rep(c("SourceA", "SourceB", "Mixture"), each = 4),
   Tracer1 = c(10, 12, 11, 13, 20, 22, 21, 23, 15, 16, 15, 17),
   Tracer2 = c(5, 6, 5, 7, 15, 14, 16, 15, 10, 11, 10, 12)
)
Graph_boxplots(data, tracers = 1:2, ncol = 2)


OceanTracer documentation built on Oct. 15, 2026, 5:09 p.m.