View source: R/age_depth_model.R
age_depth_as_sec_axis | R Documentation |
Use an age depth model as a second ggplot axis
age_depth_as_sec_axis(x, primary = c("depth", "age"), ...)
x |
An age_depth_model |
primary |
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.