# \donttest{
# Perform a PCoA ordination on the day_2016 data set:
pcoa_input <- ordinate_cladistic_matrix(cladistic_matrix = day_2016)
# Plot this as a simple bivarate morphospace:
plot_morphospace(pcoa_input = pcoa_input)
# Use the Wills technique to add a third axis (PC3):
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3)
# You may need to resize the plot to see the legend for the z-axis
# Add taxon names as well:
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3, plot_taxon_names = TRUE)
# Define some simple taxon groups for the data as a named list:
taxon_groups <- list(nonBurnetiamorpha = c("Biarmosuchus_tener",
"Hipposaurus_boonstrai", "Bullacephalus_jacksoni", "Pachydectes_elsi",
"Ictidorhinus_martinsi", "RC_20", "Herpetoskylax_hopsoni"),
Burnetiamorpha = c("Lemurosaurus_pricei", "Lobalopex_mordax",
"Lophorhinus_willodenensis", "Proburnetia_viatkensis", "Lende_chiweta",
"Paraburnetia_sneeubergensis", "Burnetia_mirabilis", "BP_1_7098"))
# Set class as taxonGroups:
class(taxon_groups) <- "taxonGroups"
# Plot taxon groups including convex hulls:
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3, plot_taxon_names = TRUE,
taxon_groups = taxon_groups, plot_convex_hulls = TRUE)
# Make time-scaled first MPT for Day 2016 data set:
time_tree <- ape::read.tree(text = paste0("(Biarmosuchus_tener:0.5,",
"(((Hipposaurus_boonstrai:3.5,(Bullacephalus_jacksoni:0.75,",
"Pachydectes_elsi:0.75):0.75):0.75,(Lemurosaurus_pricei:7.166666667,",
"(Lobalopex_mordax:4.333333333,((Lophorhinus_willodenensis:3.666666667,",
"(Proburnetia_viatkensis:0.8333333333,(Lende_chiweta:2,",
"(Paraburnetia_sneeubergensis:1,Burnetia_mirabilis:2):1):1.833333333)",
":0.8333333333):0.8333333333,(BP_1_7098:2.25,Niuksenitia_sukhonensis:",
"1.25):1.25):0.8333333333):0.8333333333):3.083333333):1.95,",
"(Ictidorhinus_martinsi:15.9,(RC_20:11.6,(Herpetoskylax_hopsoni:11.3,",
"Lycaenodon_longiceps:0.3):0.3):0.3):0.3):0.3);"))
# Add root age to tree:
time_tree$root.time <- 269.5
# Prune incomplete taxa from tree:
time_tree <- ape::drop.tip(phy = time_tree, tip = c("Lycaenodon_longiceps",
"Niuksenitia_sukhonensis"))
# Prune incomplete taxa from cladistic matrix:
cladistic_matrix <- prune_cladistic_matrix(cladistic_matrix = day_2016,
taxa2prune = c("Lycaenodon_longiceps", "Niuksenitia_sukhonensis"))
# Note: the above pruning is simply to run this example and should not be
# done manually as a matter of course as the functions will automatically
# prune tips and nodes as required.
# Make new ordination with tree included (enabling phylomorphospace):
pcoa_input <- ordinate_cladistic_matrix(cladistic_matrix = cladistic_matrix,
time_tree = time_tree)
# Plot this as a simple bivarate phylomorphospace:
plot_morphospace(pcoa_input = pcoa_input)
# Use the Wills technique to add a third axis (PC3):
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3)
# You may need to resize the plot to see the legend for the z-axis
# Add taxon names as well:
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3, plot_taxon_names = TRUE)
# Add taxon groups including convex hulls:
plot_morphospace(pcoa_input = pcoa_input, z_axis = 3, plot_taxon_names = TRUE,
taxon_groups = taxon_groups, plot_convex_hulls = TRUE)
# }
Run the code above in your browser using DataLab