plot_adjmatrix | R Documentation |
Draws a plot of the adjacency matrix represented by a vector
using the function levelplot
of the lattice
package.
plot_adjmatrix( edgevalues, type = c("undirected", "directed"), edgetype = c("real", "prob", "binary"), communities = NULL, community_labels = NULL, main = "", axislabel = "Nodes", colorlims = NULL )
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 |
edgetype |
Specify the type of edge values. For real-valued edges, |
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 |
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 |
An objected returned by the function levelplot
of the lattice
package.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.