Learn R Programming

avstrat (version 0.1.1)

ggstrat: Plot a grainsize-depth stratigraphic section

Description

Uses ggplot2 to create a grainsize vs. depth stratigraphic section plot.

Usage

ggstrat(
  df,
  section_name,
  grainsize_direction = c("increasing", "decreasing"),
  grainsize_labs = gs_volc_abbr,
  use_theme = NULL,
  xlim = c(-1, 10),
  ylim = NULL,
  depth_units = c("cm", "m"),
  ybreaks = 7,
  layer_fill = "layer_type",
  layer_fill_color = "stratpal_rpg",
  layer_border_color = "black",
  layer_border_linewidth = 0.2
)

Value

A ggplot object

Arguments

df

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

section_name

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

grainsize_direction

Character string, one of "increasing" or "decreasing". Controls the numeric mapping of grain sizes:

  • "increasing" (default): clay/silt = 1, ..., blocks/bombs/boulders = 10.

  • "decreasing": clay/silt = 10, ..., blocks/bombs/boulders = 1.

Increasing will show coarser units as bigger polygons (more prominent) which is espeically useful for emphasizing more energentic volcanic deposits. Decreasing will show finer (typically more resistive) units as bigger which may better match observed erosional profiles.

grainsize_labs

Character vector of labels for the x-axis. Several predefined options are available:

  • gs_volc_abbr: Volcanic grainsize abbreviations (default).

  • gs_sed_abbr: Sedimentary grainsize abbreviations.

  • gs_volc_names: Volcanic grainsize full names.

  • gs_sed_names: Sedimentary grainsize full names.

  • gs_numeric: Numeric grainsize labels.

use_theme

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

xlim

Numeric vector of length 2 giving x-axis limits.

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.

layer_fill

Character string naming the column to use for fill. If using anything other than "layer_type" from the template, will need to make a new palette.

layer_fill_color

Palette object to use for fill colors.

layer_border_color

Border color for polygons.

layer_border_linewidth

Border line width for polygons.

Examples

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

Run the code above in your browser using DataLab