Use an age depth model as a second ggplot axis
age_depth_as_sec_axis(x, primary = c("depth", "age"), ...)
Specify the primary axis as 'age' or 'depth'
Passed to sec_axis
A ggplot2 sec_axis for use in scale_x_continuous, scale_y_continuous, or their reverse variants.
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))