Learn R Programming

bipartite (version 2.18)

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

Value

Invoked for its side effect of plotting the matrix.

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.

Author

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

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

Run the code above in your browser using DataLab