Learn R Programming

eicm (version 1.0.3)

plotNetworkFromMatrix: Plot graphs from adjacency matrices

Description

Plots a graph from a weighted adjacency matrix, using igraph's plotting functions, optionally comparing it with another "true" adjacency matrix.

Usage

plotNetworkFromMatrix(
  adjacency,
  true.adjacency = NULL,
  labels = TRUE,
  exclude.orphans = TRUE,
  lwd = 1,
  edge.arrow.size = 0.8,
  severe.threshold = 0.5
)

Value

The corresponding igraph network, invisibly.

Arguments

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 true.adjacency is not provided).

edge.arrow.size

size of the arrow heads. See igraph::plot.igraph

severe.threshold

the absolute threshold above which the interaction weights are highlighted in the graph.

Details

When comparing two adjacency matrices

Examples

Run this code
# 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)

Run the code above in your browser using DataLab