Plot phenogram using phylogenetic and morphometric information. Used internally.

plot_phenogram(
  x = NULL,
  y = NULL,
  tree,
  phylo_scores,
  axis,
  lwd.phylo,
  lty.phylo,
  col.phylo,
  cex.nodes,
  pch.nodes,
  col.nodes,
  bg.nodes,
  cex.tips,
  pch.tips,
  col.tips,
  bg.tips,
  points
)

Arguments

x

Optional vector with a non-morphometric variable to be plotted in the x axis.

y

Optional vector with a non-morphometric variable to be plotted in the y axis.

tree

A "phylo" object containing a phylogenetic tree. Tip labels should match the row names from x or y.

phylo_scores

A matrix containing the scores from tips and nodes of the phylogeny provided in tree.

axis

Numeric; the axis to be plotted.

lwd.phylo

Integer; the width of the lines depicting phylogenetic branches.

lty.phylo

Integer; the type of the lines depicting phylogenetic branches.

col.phylo

Numeric; the color of the lines depicting phylogenetic branches.

cex.nodes

Numeric; size of the scatterpoints representing the nodes of the phylogeny.

pch.nodes

Symbol of the scatterpoints representing the nodes of the phylogeny.

col.nodes

Color of the scatterpoints representing the nodes of the phylogeny.

bg.nodes

Background color of the scatterpoints representing the nodes of the phylogeny.

cex.tips

Numeric; size of the scatterpoints representing the tips of the phylogeny.

pch.tips

Symbol of the scatterpoints representing the tips of the phylogeny.

col.tips

Color of the scatterpoints representing the tips of the phylogeny.

bg.tips

Background color of the scatterpoints representing the tips of the phylogeny.

points

Logical; whether to plot the scatter points.

Examples

#load and extract relevant data, packages and information
library(magrittr)
data("tails")
shapes <- tails$shapes
species <- tails$data$species
sp_shapes <- expected_shapes(shapes, species)
tree <- tails$tree
links <- tails$links

#generate basic morphospace, add sampled shapes, species mean shapes, and
#phylogenetic structure
msp <- mspace(shapes, mag = 0.7, axes = c(1,2), cex.ldm = 0,
              plot = FALSE) %>%
  proj_shapes(shapes = shapes, col = c(1:13)[species], pch = 1,
              cex = 0.7) %>%
  proj_shapes(shapes = sp_shapes, pch = 21, bg = 1:13, cex = 2) %>%
  proj_phylogeny(shapes = sp_shapes, tree = tree)
#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet

#get node heights
heights <- phytools::nodeHeights(tree)
node_heights <- NULL
for(i in 1:(length(tree$tip.label) + tree$Nnode)) node_heights[i] <- unique(heights[tree$edge == i])

#plot simple phengram
plot(node_heights, msp$projected$phylo_scores[,1])
#> Error in eval(expr, envir, enclos): object 'msp' not found
plot_phenogram(tree = tree, x = node_heights,
               phylo_scores = msp$projected$phylo_scores, axis = 1, lwd.phylo = 1,
               lty.phylo = 1, col.phylo = 1, cex.tips = 1, col.tips = 1,
               pch.tips = 1, cex.nodes = 1, col.nodes = 1, pch.nodes = 1,
               points = TRUE)
#> Error in eval(expr, envir, enclos): object 'msp' not found