occurrence_plot: Plot occurrences

View source: R/OccurrencePlot.R

occurrence_plotR Documentation

Plot occurrences

Description

A statistical graphic designed for the archaeological study of when events of a specified kind occurred

Usage

occurrence_plot(
  data,
  position = 1:ncol(data),
  name = list("All"),
  level = 0.95,
  plot_result = TRUE,
  intervals = "CI",
  title = "Occurrence plot",
  subtitle = NULL,
  caption = "ArchaeoPhases",
  x_label = "Calendar year",
  y_label = NULL,
  language = "English",
  occurrence = "occurrence",
  height = 7,
  width = 7,
  unit = "in",
  x_min = NULL,
  x_max = NULL,
  x_scale = "calendar",
  elapsed_origin_position = NULL,
  dumbbell_size = 1,
  dot_guide = FALSE,
  dot_guide_size = 0.25,
  y_grid = FALSE,
  columns = 1,
  file = NULL,
  new_window = TRUE
)

Arguments

data

Data frame containing the output of the MCMC algorithm.

position

A list, each member of which is either a numeric vector containing the positions of the columns corresponding to the MCMC chains of interest, or a vector of column names. For convenience, a vector can be substituted for the singleton list.

name

A list, each member of which is a string that names the kind of event in the corresponding element of position. For convenience, a string can be substituted for the singleton list.

level

Probability corresponding to the level of confidence.

plot_result

If TRUE, then draw a plot on the display, else suppress drawing.

intervals

One of "CI" for credible intervals or "HPD" for highest posterior density intervals.

title

Title of the plot.

subtitle

Subtitle of the plot.

caption

Caption of the plot.

x_label

Label of the x-axis.

y_label

Label of the y-axis.

language

String indicating a language recognized by the toOrdinal package.

occurrence

String to append to each y-axis tic label.

height

Plot height in unit.

width

Plot width in unit.

unit

String recognized by the ggsave() function, one of "in", "cm", "mm".

x_min

Minimum x-axis value.

x_max

Maximum x-axis value.

x_scale

One of "calendar" for calendar years, "BP" for years before present, or "elapsed" for time elapsed from a specified origin.

elapsed_origin_position

Position of the column to use as the origin for elapsed time calculations.

dumbbell_size

Size of the plot symbol.

dot_guide

Switch for a horizontal guide from the y axis.

dot_guide_size

Size of the dot guide.

y_grid

Switch for horizontal grid lines.

columns

Number of columns for facet.

file

Name of the file that will be saved if specified. If NULL no plot will be saved.

new_window

Whether or not the plot is drawn within a new window.

Details

If we have k events, then we can estimate the calendar date t corresponding to the smallest date such that the number of events observed before t is equal to k. The OccurrencePlot() estimates these occurrences and gives the credible interval or the highest posterior density (HPD) region with a desired level of confidence.

Value

An archaeophases_plot object with the data and metadata needed to reproduce the plot.

Author(s)

Anne Philippe, Anne.Philippe@univ-nantes.fr,

Thomas S. Dye, tsd@tsdye.online, and

Marie-Anne Vibet, Marie-Anne.Vibet@univ-nantes.fr

Examples

  data(Events);
  OccurrencePlot(Events[1:1000, ], c(2:5),  print.data.result = FALSE)


## Not run: 
# Read from connection
ox <- read_oxcal("http://tsdye.online/AP/ox.csv")
# Plot all the columns
op <- occurrence_plot(ox, position = 1:ncol(ox))
# Plot again
plot(op)
# View metadata
str(op)

## End(Not run)


ArchaeoPhases documentation built on June 22, 2022, 1:05 a.m.