h_trait_recon: Plot HiSSE model-averaged marginal ancestral state...

Description Usage Arguments Value Examples

View source: R/utilhisse.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
h_trait_recon(
  processed_recon,
  show_tip_labels = FALSE,
  trait_name = "trait",
  states_names = c("0", "1"),
  colors = c("orange", "violet"),
  discrete = FALSE,
  cutoff = 0.5,
  tree_layout = "rectangular",
  tree_direction = "right",
  time_axis_ticks = 10,
  open_angle = 10
)

Arguments

processed_recon

An object produced by h_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.

trait_name

The name of the trait to be used for guide title

states_names

The names for character states

colors

Colors for the two character states. If discrete=FALSE these colors will be used as the min/max of a color gradient.

discrete

Logical. Whether to discretize the probabilities of ancestral states into binary (0/1)

cutoff

A decimal to be used as a threshold for discretizing

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)

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data("diatoms")
processed_hisse <- h_process_recon(hisse_recon=diatoms$cid4_recon)

map_continuous <-
 h_trait_recon(
   processed_recon = processed_hisse,
   trait_name = "", discrete=FALSE, cutoff=.5)

# change colors, your can pass the trait name to `name=` to title the colorbar
map_continuous + scale_color_gradient(name="", low = "#132B43", high = "#56B1F7")

map_discrete <-
 h_trait_recon(
   processed_recon = processed_hisse,
   trait_name = "", discrete=TRUE, cutoff=.5)

# change colors
map_discrete + scale_color_manual(name="", values = c("red", "blue"))

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