add_events: Add events from sim_cophyBD to plot.cophy

Description Usage Arguments Details Examples

View source: R/plot_cophy.R

Description

This will plot the classical cophylogenetic events onto the plot from plot.cophy if event_history is non-empty. At present this only works with phylograms.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
add_events(
  cophy_obj,
  legend = TRUE,
  pch = NULL,
  col = NULL,
  gap = 1,
  fsize = 1,
  type = "phylogram",
  show_tip_label = TRUE
)

Arguments

cophy_obj

Cophylogenetic object

legend

Boolean to turn on or off the legend

pch

Length 8 vector of plotting symbols to be used

col

Length 8 vector of colors to be used in plot

gap

the gap between the two trees

fsize

the font size of tips (this must be set the same as used in plot.cophy)

type

the type of graph ("phylogram" or "cladogram")

show_tip_label

Boolean indicating whether the plot has tip labels or not

Details

The pch and color vectors place symbols or colors for the different events. The order this vector is input determines which symbol corresponds to which event. * Position 1 = cospeciation * Position 2 = host speciation * Position 3 = host extinction * Position 4 = symbiont speciation * Position 5 = symbiont extinction * Position 6 = host spread or host-switch symbiont speciation * Position 7 = anagenetic symbiont dispersal * Position 8 = anadenetic symbiont extirpation

By default a color vector is used in this order: purple, red, blue, darkorange, cyan, yellow, brown, seagreen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
host_mu <- 1.0 # death rate
host_lambda <- 2.0 # birth rate
numb_replicates <- 10
time <- 1.0
symb_mu <- 0.2
symb_lambda <- 0.4
host_shift_rate <- 0.0
cosp_rate <- 2.0

cophylo_pair <- sim_cophyBD(hbr = host_lambda,
                           hdr = host_mu,
                           cosp_rate = cosp_rate,
                           host_exp_rate = host_shift_rate,
                           sdr = symb_mu,
                           sbr = symb_lambda,
                           numbsim = numb_replicates,

                           time_to_sim = time)
plot.cophy(cophylo_pair[[1]])
add_events(cophylo_pair[[1]], legend = FALSE)

treeducken documentation built on March 3, 2021, 1:11 a.m.