tempo_plot: Tempo plot

View source: R/TempoPlot.R

tempo_plotR Documentation

Tempo plot

Description

A statistical graphic designed for the archaeological study of rhythms of the long term that embodies a theory of archaeological evidence for the occurrence of events

Usage

tempo_plot(
  data,
  position = 1:ncol(data),
  name = list("All"),
  level = 0.95,
  count = TRUE,
  Gauss = FALSE,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  legend_title = NULL,
  legend_position = "bottom",
  legend_labels = c("Bayes estimate", "Credible interval high",
    "Credible interval low"),
  x_label = "Calendar year",
  y_label = "Cumulative events",
  line_types = c("solid", "dotted", "dotted"),
  line_sizes = c(1.2, 0.8, 0.8),
  line_colors = c("black", "grey50", "grey50"),
  width = 7,
  height = 7,
  unit = "in",
  x_min = NULL,
  x_max = NULL,
  color_palette = NULL,
  file = NULL,
  x_scale = "calendar",
  elapsed_origin_position = NULL,
  columns = 1,
  new_window = TRUE,
  plot_result = TRUE
)

Arguments

data

Data frame or archaeophases_mcmc object 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.

count

If TRUE the counting process is a number, otherwise it is a probability.

Gauss

If TRUE, the Gaussian approximation of the credible interval is used.

title

Title of the plot.

subtitle

Subtitle of the plot.

caption

Caption of the plot.

legend_title

Title of the plot legend.

legend_position

One of "top", "bottom" (default), "left", "right".

legend_labels

Vector of three strings to label legend entries. The strings must be unique. The first string labels the central tendency and the second and third strings label the high and low spreads.

x_label

Label of the x-axis.

y_label

Label of the y-axis.

line_types

Type of the lines drawn on the plot in the order of legend_labels.

line_sizes

Width of the lines drawn on the plot in the order of legend_labels.

line_colors

Color names for the lines drawn on the plot in the order of legend_labels. If color_palette is NULL, then standard color names are expected, otherwise the color names are from the supplied color_palette.

width

Width of the plot in unit.

height

Height of the plot in unit.

unit

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

x_min

Minimum value for x-axis.

x_max

Maximum value for x-axis.

color_palette

A palette that supplies the colors used in the plot.

file

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

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

If x.scale is "elapsed", the position of the column corresponding to the event from which elapsed time is calculated.

columns

Number of columns for facet.

new_window

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

plot_result

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

Details

The tempo plot is one way to measure change over time: it estimates the cumulative occurrence of archaeological events in a Bayesian calibration. The tempo plot yields a graphic where the slope of the plot directly reflects the pace of change: a period of rapid change yields a steep slope and a period of slow change yields a gentle slope. When there is no change, the plot is horizontal. When change is instantaneous, the plot is vertical.

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

References

Dye, T.S. (2016) Long-term rhythms in the development of Hawaiian social stratification. Journal of Archaeological Science, 71, 1–9

See Also

TempoPlot

new_archaeophases_plot

Examples

  data(Events);
  tempo_plot(Events[1:1000, ], c(2:5))
  tempo_plot(Events[1:1000, ], c(2:5), count = TRUE)

## Not run: 
# Read from connection
ox <- read_oxcal("http://tsdye.online/AP/ox.csv")
# Plot all the columns
tp <- tempo_plot(ox)
# Reproduce the tempo plot
plot(tp)
# View metadata
str(tp)
# Check that the MCMC data file hasn't changed
original_file(tp)

# Use a custom palette
library(khroma)
light <- colours("light")
tp <- tempo_plot(ox, color_palette = light(2),
line_colors = c("light blue", "pale grey", "pale grey"))

## End(Not run)


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