plot_matrix_phylo | R Documentation |
Plot a network with modules as an adjacency matrix, with aligned phylogenies.
plot_matrix_phylo(
net,
at_nodes,
tree,
host_tree,
type = "states",
state = 2,
repertoire = "fundamental",
modules = NULL,
module_order = NULL,
find_modules = TRUE,
threshold = 0.9,
point_size = 3,
dodge_width = 0.025,
colors = NULL,
ladderize = FALSE
)
net |
An adjacency matrix for a bipartite network. This should be the extant network. Parasites should be the rows, hosts should be columns. If all values are 0 or 1 an binary network is represented, otherwise a weighted network is assumed. |
at_nodes |
A list of length 2, output from |
tree |
The phylogeny of the symbiont clade (e.g. parasites, herbivores). Object of class |
host_tree |
The phylogeny belonging to the hosts. Object of class See the examples on how to change the color scale. |
type |
One of |
state |
Which state? Default is 2. For analyses using the 3-state model, choose |
repertoire |
Either the |
modules |
A |
module_order |
A character vector giving the order that modules should be plotted. Should contain each module only once. |
find_modules |
Logical. Search for modules if nothing is provided in |
threshold |
The posterior probability above which the ancestral states should be shown.
Defaults to 90% ( |
point_size |
How large the ancestral state points should be, default at 3. Play with this
and |
dodge_width |
How far the points should be pushed apart, when there is multiple states at
a single node, default at 0.025. Play with this and |
colors |
Override the default colors. Should be a character vector with as many color values as there are modules. |
ladderize |
Logical. Whether to ladderize the tree. Default to FALSE. The ancestral states are automatically colored by module. To change what colors are used, you
can add color scales to the resulting |
An assembly of plots, of class patchwork
.
## Not run:
# 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)
extant_net <- read.csv(paste0(data_path,"/interaction_matrix_pieridae.csv"), row.names = 1)
# calculate posterior probability of interactions at internal nodes
at_nodes <- posterior_at_nodes(history, tree, host_tree, 66 + 1:65)
# plot
plot_matrix_phylo(extant_net, at_nodes, tree, host_tree)
# manual_colors
plot_matrix_phylo(extant_net, at_nodes, tree, host_tree, colors = rainbow(20))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.