plot_adjmatrix: Plots a vectorized adjacency matrix.

View source: R/Plots.R

plot_adjmatrixR Documentation

Plots a vectorized adjacency matrix.

Description

Draws a plot of the adjacency matrix represented by a vector using the function levelplot of the lattice package.

Usage

plot_adjmatrix(
  edgevalues,
  type = c("undirected", "directed"),
  edgetype = c("real", "prob", "binary"),
  communities = NULL,
  community_labels = NULL,
  main = "",
  axislabel = "Nodes",
  colorlims = NULL
)

Arguments

edgevalues

Edge values of the adjacency matrix. The argument can be either a square adjacency matrix, or a vectorized adjacency matrix. For undirected networks, the vector should contain the upper triangular part in column-major order. For directed networks use both

type

If edgevalues is a vector, this parameter specifies whether the vector represents an undirected or directed network. Default is undirected.

edgetype

Specify the type of edge values. For real-valued edges, type = "real". If the edges are between 0 and 1, tipe = "prob". For binary edges, type = "binary".

communities

Optional argument to specify a list in which each element contains an array indicating the indexes of the nodes on each community.

community_labels

Labels for each community. The array should have the same length than communities.

main

Title of the plot

axislabel

Label for the axes.

colorlims

An array with two elements indicating the minimum and maximum value in the color bar

Value

An objected returned by the function levelplot of the lattice package.

Examples


# Plot the adjacency matrix of a COBRE data subject
data(COBRE.data)
X1 <- COBRE.data$X.cobre[1,]

# Plot adjacency matrix with nodes in default order
plot_adjmatrix(X1)

# Plot adj. matrix divided by communities
data(power.parcellation)
# Node assignments (note that node 75 is missing on COBRE)
node.assignments <- power.parcellation$Master.Assignment[-75]
communities = lapply(c(1:13, -1), function(x) which(node.assignments==x))
plot_adjmatrix(X1, communities = communities, 
      community_labels = c(1:13, -1), axislabel = "Brain systems")


jesusdaniel/graphclass documentation built on Aug. 10, 2022, 3:10 p.m.