plotmatrix: Plot a Matrix as a Table with Colored Cells

Description Usage Arguments Details References See Also Examples

View source: R/plotmatrix.R

Description

Plot a matrix as a table with colored cells.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plotmatrix(
  mvalue,
  mtext = mvalue,
  ctitle = "Columns",
  rtitle = "Rows",
  vcex = 1,
  lcex = 1,
  mcex = 1,
  ctline = 3,
  rtline = 4,
  colorange = c("white", "magenta"),
  mrange = NULL,
  border = NA,
  ...
)

Arguments

mvalue

Numeric matrix used to generate colors of table.

mtext

Character or numeric matrix to display in the table, default mvalue.

ctitle

Character scalar, column title, default "Columns".

rtitle

Character scalar, row title, default "Rows".

vcex

Numeric scalar, character expansion for the table values, default 1.

lcex

Numeric scalar, character expansion for the column and row axis labels, default 1.

mcex

Numeric scalar, character expansion for the column and row axis titles, default 1.

ctline

Numeric scalar, number of lines from upper margin to display column title, default 3.

rtline

Numeric scalar, number of lines from left margin to display row title, default 4.

colorange

Vector of length 2 giving the color extremes to display for the lowest and highest values in mvalue, default c("white", "magenta").

mrange

Numeric vector of length 2, an explicit value range corresponding to colorange. When set to NULL, the default, the colorange corresponds to the range of values in mvalue.

border

Scalar or matrix of colors to be useed for the cell borders, default NA gives no border.

...

Additional parameters to color2D.matplot.

Details

Displays a plot with the same number of rectangular cells as there are values in the matrix. Each rectangle is colored to represent its corresponding value. The rectangles are arranged in the conventional display of a matrix with rows beginning at the top and columns at the left.

References

Based on a method posted by Henrik on 6 September 2013 on stackoverflow [link].

See Also

color2D.matplot

Examples

1
2
3
4
5
m <- matrix(c(6, 5, 7, 20, 30, 5, 5, 10:14), nrow=3,
 dimnames=list(c("a", "b", "c"), c("W", "X", "Y", "Z")))
plotmatrix(m)
plotmatrix(sqrt(m), m)
plotmatrix(m, mrange=c(0, 50))

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.