View source: R/index_at_ages.R
plot_index_at_ages | R Documentation |
Plot z-scores for nestedness (NODF) and/or modularity (Q) for sampled and summary networks at time points in
the past, calculated by index_at_ages_samples
and index_at_ages_summary
.
plot_index_at_ages(
nodf_sampled,
q_sampled = NULL,
nodf_summary = NULL,
q_summary = NULL,
col_sampled = "#3B9AB2",
col_summary = "#E67D00"
)
nodf_sampled |
Output of |
q_sampled |
Output of |
nodf_summary |
Output of |
q_summary |
Output of |
col_sampled |
Color used to represent values from sampled networks. |
col_summary |
Color used to represent values from summary networks. |
A plot of z-scores over time. Violins show the posterior distribution of z-scores of sampled networks, with dots and lines showing the mean values. Z-scores of summary networks and extant network are shown as dots and line. Use different colors to differentiate values from sampled and summary networks.
# read data that comes with the package
data_path <- system.file("extdata", package = "evolnets")
tree <- read_tree_from_revbayes(paste0(data_path,"/tree_pieridae.tre"))
host_tree <- ape::read.tree(paste0(data_path,"/host_tree_pieridae.phy"))
history <- read_history(paste0(data_path,"/history_thin_pieridae.txt"), burnin = 0)
# calculate posterior probabilities at ages
ages <- c(60, 50, 40, 0)
at_ages <- posterior_at_ages(history, ages, tree, host_tree)
# summary networks
summary_networks <- get_summary_networks(at_ages, threshold = 0.5, weighted = TRUE)
Nz_sum <- index_at_ages_summary(summary_networks, index = "NODF", nnull = 10)
# sampled networks
sampled_networks <- get_sampled_networks(at_ages)
Nz_sam <- index_at_ages_samples(sampled_networks, index = "NODF", nnull = 10)
# plot
plot_index_at_ages(nodf_sampled = Nz_sam, nodf_summary = Nz_sum)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.