Learn R Programming

avstrat (version 0.1.1)

ggstrat_samples: A combined grainsize-depth and sample label stratigraphic plot

Description

Combines a grainsize–depth plot and sample label plot into a single composite figure using the patchwork::patchwork framework. The two plots are aligned and legends are collected at the bottom.

Usage

ggstrat_samples(
  df,
  section_name,
  label = "stratlayer_sample",
  use_theme = NULL,
  ylim = NULL,
  depth_units = c("cm", "m"),
  ybreaks = 7
)

Value

A patchwork/ggplot object combining the stratigraphic plot and sample labels. This object can be further modified with ggplot2::theme() or additional patchwork operators.

Arguments

df

A data frame containing stratigraphic data. Must include columns stratsection_name, stratlayer_order, grainsize, depth, stratlayer_type, and SampleID.

section_name

Character string giving the section name to filter "stratsection_name".

label

Character strin gnaming the column to use for labels. Default is "SampleID".

use_theme

A ggplot2 theme object to apply to the plot, e.g., "theme_avstrat".

ylim

Numeric vector of length 2 giving y-axis limits (optional).

depth_units

Units to use for depth (y-axis) scale, either "cm" (default) or "m".

ybreaks

Number of breaks on the y-axis.

Examples

Run this code
example_data_strat |>
  ggstrat_samples(section_name = "21LSHD02")

Run the code above in your browser using DataLab