Plotmatrix is a function to plot binary and weighted matrices
plotmatrix(x, background_color="white", base_color=NULL, between_color="black",
border_color="black", modules_colors=NULL, within_color = "black", border = FALSE,
row_partitions=NULL, col_partitions=NULL, binary=TRUE, plot_labels=FALSE, xlab=NA,
ylab=NA, offset = 0.4, ...)
Invoked for its side effect of plotting the matrix.
the first argument is an interaction matrix (rows and columns are nodes; cells are links between nodes) or the list returned by sortweb
. The matrix may be binary (only 0s and 1s) or weighted.
color of the background.
define the base color for the gradient in weighted matrices. If NULL, defaults to background_color.
color of links in the regions between modules. If the matrix is weighted, links between modules are colored following a gradient from the base_color to the between_color. Only applied if partitions are provided.
color of the border plotted around modules (only if border = TRUE).
optional vector with separate colors for modules. Its lengths must match the number of partitions. If the matrix is weighted, links in each module are colored following a gradient from the base_color to the colors in modules_color. Only applied if partitions are provided.
color of links in the regions within modules. If the matrix is weighted, links within modules are colored following a gradient from the base_color to the within_color. If partitions are not provided, defines the color of links for the entire network.
logical; if TRUE, a border is plotted around each module. Only applied if partitions are provided.
optional vector with partitions for rows. The length of the vector must be the number of rows in the matrix, each value is the partition of the respective row, following the row sequence in the matrix. Partition can be defined by numeric or character values.
same as row_partitions, but for columns.
logical; plot the binary or weighted information of the matrix. If the matrix is binary, must be TRUE. If the matrix is weighted and binary is TRUE, plot the binary structure of the matrix.
logical: shall row and column names of the matrix be plotted?
label for the column axis
label for the row axis.
defines the size of each filled cell, compared to the border of each cell. Values higher than 0.4 may result in overlapping of cells.
arguments passed on to axis
ornamenting the image plot.
Rafael Barros Pereira Pinheiro rafael-bpp@hotmail.com, Gabriel Felix, Marco Mello, and the team of the Ecological Synthesis Lab, University of São Paulo
The output of sortmatrix
is used by plotmatrix
.
S <- sortmatrix(Safariland, topology = "nested", sort_by = "weights")
plotmatrix(S)
plotmatrix(S$matrix, binary=TRUE)
Run the code above in your browser using DataLab