plot_Ages: Create Age Plot

View source: R/plot_Ages.R

plot_AgesR Documentation

Create Age Plot

Description

Create Age Plot

Usage

plot_Ages(
  object,
  sample_names = NULL,
  sample_order = NULL,
  plot_mode = "ages",
  ...
)

Arguments

object

list or data.frame (required): Output as created by functions like AgeC14_Computation, which is a list of class BayLum.list. Alternatively the function supports a data.frame as input, however, in such a case the data.frame must resemble the ages data.frame created by the computation functions otherwise the input will be silently ignored.

sample_names

character (optional): alternative sample names used for the plotting. If the length of the provided character vector is shorter than the real number of samples, the names are recycled.

sample_order

numeric (optional): argument to rearrange the sample order, e.g., sample_order = c(4:1) plots the last sample first.

plot_mode

character (with default): allows to switch from displaying ages as points with lines ("ages") for the credible intervals to densities ("density")

...

further arguments to control the plot output, standard arguments are: cex, xlim, main, xlab, col further (non-standard) arguments are: grid (TRUE/FALSE), legend (TRUE/FALSE), legend.text (character input needed), legend.pos graphics::legend, legend.cex. Additional arguments: d_scale (scales density plots), show_ages (add ages to density plots)

Details

This function creates an age plot showing the mean ages along with the credible intervals. The function provides various arguments to modify the plot output, however, for an ultimate control the function returns the data.frame extracted from the input object for own plots.

Value

The function returns a plot and the data.frame used to display the data

Function version

0.1.5

How to cite

Kreutzer, S., Christophe, C., 2024. plot_Ages(): Create Age Plot. Function version 0.1.5. In: Christophe, C., Philippe, A., Kreutzer, S., Guérin, G., Baumgarten, F.H., Frerebeau, N., 2024. BayLum: Chronological Bayesian Models Integrating Optically Stimulated. R package version 0.3.2. https://CRAN.r-project.org/package=BayLum

Author(s)

Sebastian Kreutzer, Institute of Geography, Ruprecht-Karl-University of Heidelberg (Germany), based on code written by Claire Christophe

See Also

AgeC14_Computation, AgeS_Computation

Examples

## load data
data(DATA_C14,envir = environment())
C14Cal <- DATA_C14$C14[,1]
SigmaC14Cal <- DATA_C14$C14[,2]
Names <- DATA_C14$Names
nb_sample <- length(Names)

## Age computation
Age <- AgeC14_Computation(
   Data_C14Cal = C14Cal,
   Data_SigmaC14Cal = SigmaC14Cal,
   SampleNames = Names,
   Nb_sample = nb_sample,
   PriorAge = rep(c(20,60),nb_sample),
   Iter = 500,
   quiet = TRUE)

## plot output
plot_Ages(Age)

## plot output
plot_Ages(Age, plot_mode = "density")


R-Lum/BayLum documentation built on April 19, 2024, 9:33 a.m.