age_depth_as_sec_axis: Use an age depth model as a second ggplot axis

View source: R/age_depth_model.R

age_depth_as_sec_axisR Documentation

Use an age depth model as a second ggplot axis

Description

Use an age depth model as a second ggplot axis

Usage

age_depth_as_sec_axis(x, primary = c("depth", "age"), ...)

Arguments

x

An age_depth_model

primary

Specify the primary axis as 'age' or 'depth'

...

Passed to sec_axis

Value

A ggplot2 sec_axis for use in scale_x_continuous, scale_y_continuous, or their reverse variants.

Examples

library(ggplot2)
alta_lake_adm <- age_depth_model(
  alta_lake_210Pb_ages,
  depth = depth_cm,
  age = age_year_ad
)

ggplot(alta_lake_210Pb_ages, aes(y = depth_cm, x = age_year_ad)) +
  geom_path() +
  geom_point() +
  scale_y_reverse(sec.axis = age_depth_as_sec_axis(alta_lake_adm))


paleolimbot/tidypaleo documentation built on Jan. 25, 2023, 2:43 a.m.