stratPlot: stratPlot

Description Usage Arguments Details Value Examples Author(s)

Description

stratPlot builds side by side stratigraphic plots of multiple variables i.e., subplots,that are relatively sized and have consistent axis parameters, making it easy to compare multiple time-series with different means.

Usage

1
2
3
4
5
6
7
8
stratPlot(dat = dat, tymcol = "agebp", varcol = "variable",
  valcol = "value", varord = c("alph", "med")[1], grpcol = "group",
  grp_ord = unique(dat[, get(grpcol)]), grp_colours = distinctColorPalette(k
  = length(grp_ord)), grp_geom = c("area", "line")[1], grp_bline = NA,
  grp_vartype = NA, grp_const = NA, xbrkint = NA, ybrkint = NA,
  exag_by = 5, plab = "", ylab = "Time", ptt_tsize = 22,
  axs_tsize = 18, var_tsize = 20, grp_tsize = 20, pmargin = unit(c(0.05,
  0, 0.1, 0), "cm"), maxw = 5)

Arguments

dat

Required: A data.table, data.frame or matrix with the data to be plotted.

tymcol

Required: Column containing the dataset's temporal dimension.

varcol

Required: Column containing the variable labels.

valcol

Required: Column containing the values associated with the variables in the dataset.

varord

Optional: How should variables be ordered?, "alph" for alphabetically, "med" for ordering based on medians. If "med", variable plots are ordered left to right based on median (highest to lowest).

grpcol

Required: Column containing group labels by which variables will be aggregated.

grp_ord

Optional: Vector indicating groups to plot and their ordering. Only variables associated with groups in this argument will be plotted.

grp_colours

Optional: Vector of colours that will be used symbolize each group: should be of (a) length 1 in which case all groups, and hence plots, have the same colour, or (b) length equal to the number of groups in which case supplied values are applied along "grp_ord".

grp_geom

Optional: Plot geometry in which data in each group should be mapped. This should be of (a) length 1 in which case all plots have the same geometry or, (b) length equal to the number of groups in which case supplied geometries will be applied along "grp_ord".

grp_bline

Optional: X-position of plot baselines. This should be of (a) length 1 in which case all plots have the same baseline or, (b) length equal to the number of groups in which case supplied values are applied along "grp_ord"

grp_vartype

Optional: Vector of X axis labels for each group: should be of (a) length 1 in which case all plots have the same X-axis label, or (b) length equal to the number of groups in which case supplied values are applied along "grp_ord".

grp_const

Optional: Vector indicating groups whose plot widths should not be relatively scaled.

xbrkint

Optional: X-axis break interval. This should be of (a) length 1 in which case all plots have the same X-axis break interval or, (b) length equal to the number of groups in which case supplied values are applied along "grp_ord".

ybrkint

Optional: Analogous to the "xbrkint" interval.

exag_by

optional: Factor by which to exaggerrate area plots in order to amplify very small values.

plab

Optional: Main plot title

ylab

Y-axis title i.e., title to associate with tymcol

ptt_tsize

Optional: Text size of the main plot title; if supplied in the "plab" argument.

axs_tsize

Optional: Text size of axis text

var_tsize

Optional: Text size of variable plot titles. Variable plot titles are read from the column supplied to the "varcol" argument.

grp_tsize

Optional: Text size of group labels. Group labels are read from the column supplied to the "varcol" argument.

pmargin

Optional: Unit object indicating margins to use around variable plots: top, right, bottom, and left.

maxw

Optional: Width that the variable with the maximum range in each group of variables should have (in cms). Widths of the other variables are calculated relative to this value and therefore, this argument determines the total width of the final plot as well.

Details

StratPlot uses ggplot2 to construct gridded time-series plots of multiple variables. Importantly, it 1) allows plot sizes to be relatively scaled; 2) provides fine control of plotting parameters e.g., axis breaks; 3) is designed for the visualisation of stratigraphic datasets, which often have many variables of different kinds but can be used or adapted to work with other time-series data.

Value

A list of length 2 containing:

(1) $plot: A plot object of class "grob" from which a graphical output can be produced with grid or grid.arrange

(2) $width: Width of the generated plot (in cm)

Examples

See stratR vignette

Author(s)

John Shekeine, Basil Davis ARVE Research Group, University of Lausanne


shekeine/stratR documentation built on May 29, 2019, 9:22 p.m.