plotColorMatrix: Plots a numeric matrix using a color scale

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

View source: R/plotPercentageMatrix.r

Description

Plots a numeric matrix using a color scale.

Usage

1
2
3
4
5
plotColorMatrix(x, breaks = c(50, 20, 10, 5, 2, 0)/100, colors = if
  (useHatching) c("black", "white") else c("orangered3", "khaki", "royalblue4"),
  useHatching = FALSE, translateRownames = function(x) {     x },
  translateColnames = function(x) {     x }, mar = c(5, 5, 1, 8),
  rowGroups = rep(1, nrow(x)))

Arguments

x

Numeric matrix with column and row names.

breaks

Numeric vector defining breaks in the legend. This typically includes the lower limit (e.g. zero for percentage data) but not the upper limit. The default is useful for fraction data (range 0...1).

colors

A vector of color names to build the palette.

useHatching

Use hatching to improve the distinction between neighboring colors? (logical)

translateRownames

Function to translate row names. Must accept a vector and return a vector of character strings of the same length as the input

translateColnames

Function to translate column names. Must accept a vector and return a vector of character strings of the same length as the input

mar

Vector of length 4 passed to the mar element of par. The last element (right margin) must be chosen large enough so as to not cut off the automatic legend.

rowGroups

A vector of e.g. factors splitting the rows of x into groups. Lines will be plotted at the transition between groups.

Value

invisible(NULL).

Note

Note that the matrix is plotted in transposed form.

Author(s)

David Kneis david.kneis@tu-dresden.de

References

No references.

See Also

No links.

Examples

1
2
3
4
5
6
7
8
x <- matrix(runif(24), nrow=4, ncol=6,
 dimnames=list(paste("row", 1:4), paste("col", 1:6)))
plotColorMatrix(x=x, breaks=c(50,20,10,5,2,0)/100,
 useHatching=TRUE, translateColnames=function(x){sapply(x, gsub,
   patter="col", replacement="column", fixed=TRUE)}, rowGroups= c(1,1,2,2))
plotColorMatrix(x=x, breaks=c(50,20,10,5,2,0)/100,
 useHatching=FALSE, translateColnames=function(x){sapply(x, gsub,
 patter="col", replacement="column", fixed=TRUE)}, rowGroups= c(1,1,2,2))

dkneis/knut documentation built on Jan. 7, 2020, 4:27 a.m.