View source: R/plot-networks.r
plotNetworkFromMatrix | R Documentation |
Plots a graph from a weighted adjacency matrix, using igraph
's plotting functions,
optionally comparing it with another "true" adjacency matrix.
plotNetworkFromMatrix(
adjacency,
true.adjacency = NULL,
labels = TRUE,
exclude.orphans = TRUE,
lwd = 1,
edge.arrow.size = 0.8,
severe.threshold = 0.5
)
adjacency |
the square adjacency matrix. |
true.adjacency |
optional. The reference "true" square adjacency matrix to which to compare the first one. |
labels |
logical. Draw default labels? |
exclude.orphans |
logical. Hide nodes without links? |
lwd |
a numerical value giving the amount by which the arrows' line width should be magnified
relative to the default, when plotting the weighted graph (only used when
|
edge.arrow.size |
size of the arrow heads. See |
severe.threshold |
the absolute threshold above which the interaction weights are highlighted in the graph. |
When comparing two adjacency matrices
The corresponding igraph network, invisibly.
The arrow direction depicts the direction of the interaction. Species in columns affect species in rows.
The matrices should include row and column labels, otherwise the node labels may not correspond to the species index
(when exclude.orphans = TRUE
)
# generate two adjacency matrices with 15 species and 10 interactions
A <- matrix(0, ncol=15, nrow=15)
A[sample(length(A), 10)] <- runif(10)
B <- matrix(0, ncol=15, nrow=15)
B[sample(length(B), 10)] <- runif(10)
# set the species names
rownames(A) <- rownames(B) <-
colnames(A) <- colnames(B) <- paste0("S", 1:15)
plotNetworkFromMatrix(A, B)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.