plotBM: Visualization of a binary matrix

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/plotBinaryMatrix.R

Description

This function produces simple, heatmap-like visualizations of binary matrices.

Usage

1
plotBM(x, boxCol = "darkblue", reorder = FALSE, frame = TRUE, ...)

Arguments

x

Binary matrix to visualize

boxCol

Color to use for boxes of '1's

reorder

logical; states whether the rows shall be reordered according to the size of the category

frame

logical; states whether a frame should be drawn around the visualization. In contrast to the frame drawn in plot.default, there is no gap between the visualization and this frame.

...

further arguments passed on to plot.default

Details

For reordering, each row is interpreted as a binary matrix, for example a row z=(1,0,0,1) would be interpreted as the binary number 1001 = 9 in the decimal system. Rows are then reordered by the frequency of each binary number with the rows that correspond to the most frequent binary number shown at the top in the visualization.

Value

The function invisibly returns the (reordered) matrix x, but its mainly called for its side effect of producing the visualization.

Note

An alternative way to display such matrices are given by heatmap or, the simpler version thereof, image. However, image files produced with this functions tend to be very large. This function uses plot.default and polygon which results in much smaller file sizes and is sufficient for binary matrices.

Author(s)

Joern Toedling

See Also

polygon,colors

Examples

1
2
3
4
5
6

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: RColorBrewer
Loading required package: limma

Attaching package: 'limma'

The following object is masked from 'package:BiocGenerics':

    plotMA

Loading required package: Matrix
Loading required package: grid
Loading required package: lattice
Warning message:
In read.dcf(con) :
  URL 'http://bioconductor.org/BiocInstaller.dcf': status was 'Couldn't resolve host name'
  I II III IV
a 0  0   1  0
b 0  1   1  0
c 1  0   1  0
d 1  0   0  1
e 1  0   0  0
f 1  1   0  1
g 1  0   0  1
h 0  0   1  1
i 0  0   0  0
j 1  0   0  1
k 1  1   1  1
l 1  1   0  0
m 0  1   0  1
n 0  0   1  0
o 1  0   0  0
p 0  1   1  0
q 0  1   0  0
r 0  1   1  0
s 0  1   1  0
t 1  1   1  0

Ringo documentation built on Nov. 8, 2020, 5:34 p.m.