plot_phylo_all: Plot all Chronograms with Study Titles and Geochronological...

View source: R/plot_phylo_all.R

plot_phylo_allR Documentation

Plot all Chronograms with Study Titles and Geochronological Axis

Description

Plot all Chronograms with Study Titles and Geochronological Axis

Usage

plot_phylo_all(
  chronograms,
  include = TRUE,
  individually = TRUE,
  folder_name = "phylo_all",
  max_depth,
  plot_type = "phyloch",
  time_axis = TRUE,
  mai1,
  mai2,
  mai3,
  mai4,
  omi1,
  omi2,
  omi3,
  omi4,
  plot_height,
  plot_width,
  write = "no",
  file_name = "chronogram",
  geologic_timescale = "strat2012",
  geologic_unit = "period",
  axis_label = "Time (MYA)",
  cex_tiplabels = graphics::par("cex"),
  cex_axislabel = graphics::par("cex"),
  cex_axis = graphics::par("cex"),
  cex_title = graphics::par("cex"),
  pos_title = 1,
  pos_axis = 1,
  center_axislabel = 0.5,
  ...
)

Arguments

chronograms

A list of chronograms as 'multiPhylo' or as a plain 'list' object.

include

Boolean or numeric vector. Default to TRUE, keep all chronograms in chronograms. If FALSE, exclude chronograms with only two tips. If numeric, it is used as indices to subset chronograms object.

individually

Boolean indicating if chronograms should be plotted one by one or appended to the same file.

folder_name

A character string indicating the name of the folder to write the chronogram plot files to. Default to "phylo_all". Only relevant if 'write = "png"' or 'write = "pdf"'.

max_depth

A numeric vector of length 1, indicating the upper limit of the time scale on the x axis to be used on all plots. If none is provided, it is estimated by getting the time depth of the oldest chronogram, adding 5 and rounding to the closest 10. See details for more.

plot_type

A character vector of length one indicating the type of plot to generate. Options are:

"ape"

It uses the functions [ape::plot.phylo()] and [ape::axisPhylo()].

"phyloch"

It uses the functions [ape::plot.phylo()] and [phyloch::axisGeo()].

"strap"

It uses the function [strap::geoscalePhylo()] from the package [strap].

"phytools"

Not implemented yet. It will use functions from the package [phytools]

time_axis

Default to 'TRUE', add a time axis to the tree plot.

mai1

A numeric value indicating internal plot margin sizes in inches. 'mai4' is particularly important as it indicates the space needed for plotting whole tip labels on the right margin of the plot.

mai2

A numeric value indicating internal plot margin sizes in inches. 'mai4' is particularly important as it indicates the space needed for plotting whole tip labels on the right margin of the plot.

mai3

A numeric value indicating internal plot margin sizes in inches. 'mai4' is particularly important as it indicates the space needed for plotting whole tip labels on the right margin of the plot.

mai4

A numeric value indicating internal plot margin sizes in inches. 'mai4' is particularly important as it indicates the space needed for plotting whole tip labels on the right margin of the plot.

omi1

A numeric value indicating outter plot margin sizes in inches.

omi2

A numeric value indicating outter plot margin sizes in inches.

omi3

A numeric value indicating outter plot margin sizes in inches.

omi4

A numeric value indicating outter plot margin sizes in inches.

plot_height

A numeric value indicating height and width for the plot.

plot_width

A numeric value indicating height and width for the plot.

write

A character vector of length 1 indicating the file extension to write the plots to. Options are "pdf" or "png". Anything else will not write a file.

file_name

A character string indicating a file name to write the chronogram plots to. Relevant if 'write = "png"' or 'write = "pdf"'.

geologic_timescale

A dataframe of geochronological limits.

geologic_unit

A character vector used to select geological time units that shall be displayed. When using gradstein04, "eon", "era", "period", "epoch", and "stage" are available.

axis_label

A character string used to provide information on time units. Defaults to "Time (MYA)" (time in million years ago). If NULL, time units are not added.

cex_tiplabels

A numeric value indicating **c**haracter **ex**pansion (i.e., size scaling factor) of tip labels in 'chronogram'. Default to value given by 'graphics::par("cex")'.

cex_axislabel

A numeric indicating character expansion for the time axis label. Default to value given by 'graphics::par("cex")'.

cex_axis

A numeric indicating character expansion for the axis. Default to value given by 'graphics::par("cex")'.

cex_title

A numeric indicating character expansion for the title. Default to value given by 'graphics::par("cex")'.

pos_title

Indicates the line position of the title. Default to 1.

pos_axis

Indicates the line position of the axis. Default to 1.

center_axislabel

A numeric indicating centering position of time axis label. Default to 0.5.

...

Arguments passed on to ape::plot.phylo

x

an object of class "phylo" or of class "multiPhylo".

type

a character string specifying the type of phylogeny to be drawn; it must be one of "phylogram" (the default), "cladogram", "fan", "unrooted", "radial", "tidy", or any unambiguous abbreviation of these.

use.edge.length

a logical indicating whether to use the edge lengths of the phylogeny to draw the branches (the default) or not (if FALSE). This option has no effect if the object of class "phylo" has no ‘edge.length’ element.

node.pos

a numeric taking the value 1 or 2 which specifies the vertical position of the nodes with respect to their descendants. If NULL (the default), then the value is determined in relation to ‘type’ and ‘use.edge.length’ (see details).

show.tip.label

a logical indicating whether to show the tip labels on the phylogeny (defaults to TRUE, i.e. the labels are shown).

show.node.label

a logical indicating whether to show the node labels on the phylogeny (defaults to FALSE, i.e. the labels are not shown).

edge.color

a vector of mode character giving the colours used to draw the branches of the plotted phylogeny. These are taken to be in the same order than the component edge of phy. If fewer colours are given than the length of edge, then the colours are recycled.

edge.width

a numeric vector giving the width of the branches of the plotted phylogeny. These are taken to be in the same order than the component edge of phy. If fewer widths are given than the length of edge, then these are recycled.

edge.lty

same as the previous argument but for line types; 1: plain, 2: dashed, 3: dotted, 4: dotdash, 5: longdash, 6: twodash.

node.color

a vector of mode character giving the colours used to draw the perpendicular lines associated with each node of the plotted phylogeny. These are taken to be in the same order than the component node of phy. If fewer colours are given than the length of node, then the colours are recycled.

node.width

as the previous argument, but for line widths.

node.lty

as the previous argument, but for line types; 1: plain, 2: dashed, 3: dotted, 4: dotdash, 5: longdash, 6: twodash.

font

an integer specifying the type of font for the labels: 1 (plain text), 2 (bold), 3 (italic, the default), or 4 (bold italic).

cex

a numeric value giving the factor scaling of the tip and node labels (Character EXpansion). The default is to take the current value from the graphical parameters.

adj

a numeric specifying the justification of the text strings of the labels: 0 (left-justification), 0.5 (centering), or 1 (right-justification). This option has no effect if type = "unrooted". If NULL (the default) the value is set with respect of direction (see details).

srt

a numeric giving how much the labels are rotated in degrees (negative values are allowed resulting in clock-like rotation); the value has an effect respectively to the value of direction (see Examples). This option has no effect if type = "unrooted".

no.margin

a logical. If TRUE, the margins are set to zero and the plot uses all the space of the device (note that this was the behaviour of plot.phylo up to version 0.2-1 of ‘ape’ with no way to modify it by the user, at least easily).

root.edge

a logical indicating whether to draw the root edge (defaults to FALSE); this has no effect if ‘use.edge.length = FALSE’ or if ‘type = "unrooted"’.

label.offset

a numeric giving the space between the nodes and the tips of the phylogeny and their corresponding labels. This option has no effect if type = "unrooted".

underscore

a logical specifying whether the underscores in tip labels should be written as spaces (the default) or left as are (if TRUE).

x.lim

a numeric vector of length one or two giving the limit(s) of the x-axis. If NULL, this is computed with respect to various parameters such as the string lengths of the labels and the branch lengths. If a single value is given, this is taken as the upper limit.

y.lim

same than above for the y-axis.

direction

a character string specifying the direction of the tree. Four values are possible: "rightwards" (the default), "leftwards", "upwards", and "downwards".

lab4ut

(= labels for unrooted trees) a character string specifying the display of tip labels for unrooted trees (can be abbreviated): either "horizontal" where all labels are horizontal (the default if type = "u"), or "axial" where the labels are displayed in the axis of the corresponding terminal branches. This option has an effect if type = "u", "f", or "r".

tip.color

the colours used for the tip labels, eventually recycled (see examples).

plot

a logical controlling whether to draw the tree. If FALSE, the graphical device is set as if the tree was plotted, and the coordinates are saved as well.

rotate.tree

for "fan", "unrooted", or "radial" trees: the rotation of the whole tree in degrees (negative values are accepted).

open.angle

if type = "f" or "r", the angle in degrees left blank. Use a non-zero value if you want to call axisPhylo after the tree is plotted.

node.depth

an integer value (1 or 2) used if branch lengths are not used to plot the tree; 1: the node depths are proportional to the number of tips descending from each node (the default and was the only possibility previously), 2: they are evenly spaced.

align.tip.label

a logical value or an integer. If TRUE, the tips are aligned and dotted lines are drawn between the tips of the tree and the labels. If an integer, the tips are aligned and this gives the type of the lines (lty).

Details

Currently, max_depth is obtained by default with 'round(max(sapply(chronograms, function(x) max(ape::branching.times(x)))) + 5, digits = -1)'.


phylotastic/datelifeplot documentation built on July 14, 2022, 12:35 p.m.