Add an axis with a geological timescaleSource:
axis_geo behaves similarly to
axis in that it
adds an axis to the specified side of a base R plot. The main difference is
that it also adds a geological timescale between the plot and the axis. The
default scale includes international epochs from the the Geological Timescale
GTS2020). However, international stages, periods, eras,
and eons are also available. Interval data hosted by
Macrostrat are also available (see
time_bins). A custom interval dataset can also be used (see
Details below). The appearance of the axis is highly customisable (see Usage
below), with the intent that plots will be publication-ready.
axis_geo( side = 1, intervals = "epoch", height = 0.05, fill = NULL, lab = TRUE, lab_col = NULL, lab_size = 1, rot = 0, abbr = TRUE, center_end_labels = TRUE, skip = c("Quaternary", "Holocene", "Late Pleistocene"), bord_col = "black", lty = par("lty"), lwd = par("lwd"), bkgd = "grey90", neg = FALSE, exact = FALSE, round = FALSE, tick_at = NULL, tick_labels = TRUE, phylo = FALSE, root.time = NULL, ... ) axis_geo_phylo(...)
integer. Which side to add the axis to (
1: bottom, the default;
The interval information to use to plot the axis: either A) a
characterstring indicating a rank of intervals from the built-in
GTS2020, B) a
characterstring indicating a
data.framehosted by Macrostrat (see
time_bins), or C) a custom
data.frameof time interval boundaries (see Details). A list of strings or data.frames can be supplied to add multiple time scales to the same side of the plot (see Details).
numeric. The relative height (or width if
4) of the scale. This is relative to the height (if
3) or width (if
4) of the plot.
character. The fill colour of the boxes. The default is to use the
colorcolumn included in
intervals. If a custom dataset is provided with
colorcolumn and without specifying
fill, a greyscale will be used. Custom fill colours can be provided with this option (overriding the
colorcolumn) and will be recycled if/as necessary.
logical. Should interval labels be included?
character. The colour of the labels. The default is to use the
lab_colorcolumn included in
intervals. If a custom dataset is provided with
lab_colorcolumn and without specifying
lab_col, all labels will be black. Custom label colours can be provided with this option (overriding the
lab_colorcolumn) and will be recycled if/as necessary.
numeric. The size of the labels (see
numeric. The amount of counter-clockwise rotation to add to the labels (in degrees). Note, labels for axes added to the left or right sides are already rotated 90 degrees.
logical. Should labels be abbreviated? This only works if the data has an
abbrcolumn, otherwise the
namecolumn will be used regardless of this setting.
logical. Should labels be centered within the visible range of intervals at the ends of the axis?
charactervector of interval names indicating which intervals should not be labeled. If
TRUE, this can also include interval abbreviations. Quaternary, Holocene, and Late Pleistocene are skipped by default. Set to NULL if this is not desired.
character. The border colour of the interval boxes.
numeric. Line width (see
character. The colour of the background of the scale when no intervals are being shown.
logical. Set this to
TRUEif your x-axis is using negative values. If the entire axis is already negative, this will be set to
logical. Set this to
TRUEif you want axis tick marks and numeric tick labels placed at the interval boundaries. If
TRUE, this overrides
integer. Number of decimal places to which exact axis labels should be rounded (using
round). If no value is specified, the exact values will be used. Trailing zeros are always removed.
tick_labelscan be used to include labels with trailing zeros.
numericvector specifying custom points at which tick marks are to be drawn on the axis. If specified, this is passed directly to
TRUE, these values are converted as necessary for the phylogenetic axis limits. If this is set to
NULL(the default) tick mark locations are computed automatically (see
Either a) a
logicalvalue specifying whether (numerical) annotations should be made at the tick marks specified by
tick_at, or b) a custom
expressionvector of labels to be placed at the tick marks. If
tick_atis specified, this argument is passed directly to
TRUE, this is the time assigned to the root node of the tree. By default, this is taken from the
root.timeelement of the plotted tree.
Further arguments that are passed directly to
No return value. Function is used for its side effect, which is to add an axis of the geological timescale to an already existing plot.
If a custom
data.frame is provided (with
intervals), it should
consist of at least 3 columns of data. See
GTS2020 for an
nameis also allowed) lists the names of each time interval. These will be used as labels if no abbreviations are provided.
max_ageis also allowed) lists the oldest boundary of each time interval. Values should always be positive.
min_ageis also allowed) lists the youngest boundary of each time interval. Values should always be positive.
abbrcolumn is optional and lists abbreviations that may be used as labels.
coloris also allowed) is also optional and lists a colour for the background for each time interval (see the Color Specification section
lab_coloris also allowed) column is also optional and lists a colour for the label for each time interval (see the Color Specification section
intervals may also be a list if multiple time scales should be added
to a single side of the plot. In this case,
lwd can also be lists. If these lists are not as long as
intervals, the elements will be recycled. If individual values
(or vectors, e.g. for
skip) are used for these parameters, they will
be applied to all time scales (and recycled as necessary). If multiple scales
are requested they will be added sequentially outwards starting from the plot
border. The axis will always be placed on the outside of the last scale.
axis_geo_phylo(...) is shorthand for
axis_geo(..., phylo = TRUE).
# track user par oldpar <- par(no.readonly = TRUE) # single scale on bottom par(mar = c(6.1, 4.1, 4.1, 2.1)) # modify margin plot(0:100, axes = FALSE, xlim = c(100, 0), ylim = c(100, 0), xlab = NA, ylab = "Depth (m)") box() axis(2) axis_geo(side = 1, intervals = "period") # the line argument here depends on the absolute size of the plot title(xlab = "Time (Ma)", line = 4) # stack multiple scales, abbreviate only one set of labels par(mar = c(7.1, 4.1, 4.1, 2.1)) # further expand bottom margin plot(0:100, axes = FALSE, xlim = c(100, 0), ylim = c(100, 0), xlab = NA, ylab = "Depth (m)") box() axis(2) axis_geo(side = 1, intervals = list("epoch", "period"), abbr = list(TRUE, FALSE)) # the line argument here depends on the absolute size of the plot title(xlab = "Time (Ma)", line = 6) # scale with MacroStrat intervals par(mar = c(6.1, 4.1, 4.1, 2.1)) # modify margin plot(0:30, axes = FALSE, xlim = c(30, 0), ylim = c(30, 0), xlab = NA, ylab = "Depth (m)") box() axis(2) axis_geo(side = 1, intervals = "North American land mammal ages") # the line argument here depends on the absolute size of the plot title(xlab = "Time (Ma)", line = 4) # scale with custom intervals intervals <- data.frame(min_ma = c(0, 10, 25, 32), max_ma = c(10, 25, 32, 40), interval_name = c("A", "B", "C", "D")) par(mar = c(6.1, 4.1, 4.1, 2.1)) # modify margin plot(0:40, axes = FALSE, xlim = c(40, 0), ylim = c(40, 0), xlab = NA, ylab = "Depth (m)") box() axis(2) axis_geo(side = 1, intervals = intervals) # the line argument here depends on the absolute size of the plot title(xlab = "Time (Ma)", line = 4) # scale with phylogeny library(phytools) data(mammal.tree) plot(mammal.tree) axis_geo_phylo() title(xlab = "Time (Ma)", line = 4) # scale with fossil phylogeny library(paleotree) data(RaiaCopesRule) plot(ceratopsianTreeRaia) axis_geo_phylo() title(xlab = "Time (Ma)", line = 4) # reset user par par(oldpar)