Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotmatrix

Plot a matrix organised by topology


Description

Plotmatrix is a function to plot binary and weighted matrices

Usage

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, ...)

Arguments

x

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.

background_color

color of the background.

base_color

define the base color for the gradient in weighted matrices. If NULL, defaults to background_color.

between_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.

border_color

color of the border plotted around modules (only if border = TRUE).

modules_colors

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.

within_color

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.

border

logical; if TRUE, a border is plotted around each module. Only applied if partitions are provided.

row_partitions

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.

col_partitions

same as row_partitions, but for columns.

binary

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.

plot_labels

logical: shall row and column names of the matrix be plotted?

xlab

label for the column axis

ylab

label for the row axis.

offset

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.

Value

Invoked for its side effect of plotting the matrix.

Author(s)

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

See Also

The output of sortmatrix is used by plotmatrix.

Examples

S <- sortmatrix(Safariland, topology = "nested", sort_by = "weights")
plotmatrix(S)
plotmatrix(S$matrix, binary=TRUE)

bipartite

Visualising Bipartite Networks and Calculating Some (Ecological) Indices

v2.16
GPL
Authors
Carsten F. Dormann, Jochen Fruend and Bernd Gruber, with additional code from Stephen Beckett, Mariano Devoto, Gabriel Felix, Jose Iriondo, Tove Opsahl, Rafael Pinheiro, Rouven Strauss and Diego Vazquez, also based on C-code developed by Nils Bluethgen, Aaron Clauset/Rouven Strauss and Miguel Rodriguez-Girones
Initial release
2021-02-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.