m_trait_recon_cp: Plot MuHiSSE model-averaged marginal ancestral state...

Description Usage Arguments Value Examples

View source: R/utilhisse.R

Description

A function to plot a MuHiSSE (model-averaged) marginal ancestral reconstruction for the trait data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
m_trait_recon_cp(
  processed_recon,
  show_tip_labels = FALSE,
  tree_layout = "rectangular",
  tree_direction = "right",
  time_axis_ticks = 10,
  open_angle = 10,
  focal_character = c("prob_0x", "prob_x0"),
  focal_character_label,
  second_character_label,
  colors = viridis(9)[c(5, 1, 9)]
)

Arguments

processed_recon

An object produced by m_process_recon

show_tip_labels

Logical, whether to plot tip labels. Default is FALSE because it is difficult to plot legible tip labels for larger trees common in this type of analysis. See ?m_trait_recon for a good manual solution.

tree_layout

A layout for the tree. Available options are 'rectangular' (default), 'slanted', 'circular', 'fan' and 'radial'.

tree_direction

'right' (default), 'left', 'up', or 'down' for rectangular and slanted tree layouts

time_axis_ticks

numeric giving the number of ticks for the time axis (default=10). Passed on to pretty internally, so the number of plotted ticks might not be exactly the same.

open_angle

The degrees of empty space between the first and last tip. Only works for tree_layout = 'fan' and allows for a little more space around axis tick labels.

focal_character

Specifies the x axis of the two-dimensional color key. Either prob_0x to plot the probability of state 0 for the first character, or prob_x0 to plot the probability for state 0 for the second character.

focal_character_label

Label for the x axis of the two-dimensional color gradient. This should match the focal probability.

second_character_label

Label for the y axis of the two-dimensional color gradient.

colors

A vector of three colors in the order: (1) zero color (color when the two traits are in state 0), (2) horizontal_color (color to interpolate towards state 1 of the focal character) and (2) vertical_color (color to interpolate towards state 1 of the second character). See ?colorplaner::color_projections for details.

Value

A plot of the phylogeny with branches colored by muhisse-inferred marginal ancestral states.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library("colorplaner")
data("diatoms")
processed_muhisse <- m_process_recon(muhisse_recon=diatoms$muhisse_recon)

m_trait_recon_cp(
 processed_recon = processed_muhisse,
 tree_layout = "fan",
 focal_character = "prob_0x",
 focal_character_label = "p(marine)",
 second_character_label = "p(plankton)",
 colors = c("#21908CFF", "#440154FF", "#FDE725FF")
 )

teofiln/utilhisse documentation built on Sept. 3, 2020, 2:55 p.m.