m_scatterplot_cp: Plot diversification rates estimated by a HiSSE model with...

Description Usage Arguments Value Examples

View source: R/utilhisse.R

Description

A function to plot a jittered scatterplot of (model-averaged) diversification rates in the alternative states.

Usage

1
2
3
4
5
6
7
8
9
m_scatterplot_cp(
  processed_recon,
  parameter = "turnover",
  focal_character = c("prob_0x", "prob_x0"),
  focal_character_label,
  second_character_label,
  colors,
  plot_as_waiting_time = FALSE
)

Arguments

processed_recon

An object produced with m_process_recon

parameter

The diversification parameter to be plotted on the y axis. Possible options are turnover, extinct.frac, net.div, speciation, extinction

focal_character

Specifies the x axis. 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 scatterplot and two-dimensional color gradient. This should match the focal probability.

second_character_label

Label for the y axis of the scatterplot and 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.

plot_as_waiting_time

Logical, whether to convert the rate to waiting time (1/rate)

Value

A scatterplot with focal probability (0 or 1) on the x axis and the chosen diversification parameter on the y axis with means and error bars (mean +/- SD) for each state color coded with in two-dimensional colorplane.

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_scatterplot_cp(
 processed_recon = processed_muhisse,
 parameter = "turnover",
 focal_character = "prob_0x",
 focal_character_label = "p(mar)",
 second_character_label = "p(pla)",
 colors = c("#21908CFF", "#440154FF", "#FDE725FF"),
 plot_as_waiting_time = TRUE) +
 labs(y="Net turnover\n(waiting time in millions of years)")

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