machu.respplot: Visualize response curves of taxa to climate variables

View source: R/machuruku_code.R

machu.respplotR Documentation

Visualize response curves of taxa to climate variables

Description

Visualize response curves for taxa and climate variables. The main input can be either a "response table" (machu.1.tip.resp() output), for visualizing present-day taxa, or "ace table" (subsetted machu.2.ace() output), for visualizing ancestral taxa. In the case when uncertainty for reconstructed parameters is retained by machu.2.ace() (when unc=T), the function will visualize this uncertainty by reconstructing every possible combination of skew-normal distribution parameters (n=27) plus the median distribution as a thick dashed line.

Usage

machu.respplot(
  x,
  taxa = NULL,
  clim = NULL,
  lty = 1,
  lwd = 1,
  col = NULL,
  fill = F,
  plot = "separate",
  plot.asp = 16/9,
  legend.cex = 1
)

Arguments

x

Main input, either output from machu.1.tip.resp() or from machu.2.ace(). In the case of the latter it must be a single subsetted list element, i.e. ace[1]. If uncertainty was included from the machu.2.ace analysis, the plots will visualize it.

taxa

Taxa to be plotted, a character or numeric vector specifying the desired taxa names or indices. If NULL, all taxa will be plotted.

clim

Climate variables to be plotted, a character vector. If NULL, all climate variables will be plotted.

lty

Line type for the plots. Default = 1 (solid line).

lwd

Line width for the plots. Default = 1.

col

Colors for the plots. If NULL, defaults to the "Set2" palette from RColorBrewer.

fill

Whether to fill the area beneath each response curve. Default = F.

plot

How to arrange plots of multiple climate variables. When "separate", plot each in its own window. When "together", plot all in the same window, using n2mfrow to calculate the best arrangement given a specified aspect ratio ('plot.asp'). Default = "separate"

plot.asp

Aspect ratio used to calculate the best arrangement of plots when plot="together". Default = 16/9.

legend.cex

Size of the taxon legend. Default = 1.

Value

Displays a plot or plots showing the response of the specified taxa to the specified climate variable(s).

Examples

# Plot the responses of every taxon to every climate variable, together in the same window
machu.respplot(resp, plot="t")
# Plot the response of only the first taxon to the first climate variable, filling in the area under the curve
dev.off()
machu.respplot(resp, taxa=1, clim="bio1", fill=T)
# Plot the response of the first three taxa to the first three climate variables, in separate windows
machu.respplot(resp, taxa=1:3, clim=c("bio1", "bio2", "bio3"), fill=T, plot="s")

# Plot the response of ancestral taxa at 1 Ma, without uncertainty
ace <- machu.2.ace(resp, tree, timeslice=1e6)
machu.respplot(ace[[1]], fill=T, plot="t")
# Plot the response of ancestral taxa at 1 Ma, with uncertainty
dev.off()
ace <- machu.2.ace(resp, tree, timeslice=1e6, unc=T)
machu.respplot(ace[[1]], fill=T, plot="t")

# Compare the responses of present-day to ancestral (nodal) taxa with respect to the first climate variable
dev.off()
ace <- machu.2.ace(resp, tree)
machu.respplot(ace[[1]], clim="bio1", fill=T)

wxguillo/machuruku documentation built on Jan. 23, 2025, 3:25 p.m.