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
)
Optional vector with a non-morphometric variable to be plotted in the x axis.
Optional vector with a non-morphometric variable to be plotted in the y axis.
A "phylo"
object containing a phylogenetic tree. Tip
labels should match the row names from x
or y
.
A matrix containing the scores from tips and nodes of
the phylogeny provided in tree
.
Numeric; the axis to be plotted.
Integer; the width of the lines depicting phylogenetic branches.
Integer; the type of the lines depicting phylogenetic branches.
Numeric; the color of the lines depicting phylogenetic branches.
Numeric; size of the scatterpoints representing the nodes of the phylogeny.
Symbol of the scatterpoints representing the nodes of the phylogeny.
Color of the scatterpoints representing the nodes of the phylogeny.
Background color of the scatterpoints representing the nodes of the phylogeny.
Numeric; size of the scatterpoints representing the tips of the phylogeny.
Symbol of the scatterpoints representing the tips of the phylogeny.
Color of the scatterpoints representing the tips of the phylogeny.
Background color of the scatterpoints representing the tips of the phylogeny.
Logical; whether to plot the scatter points.
#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