tableColVal: Table with values with value-dependent colored backgrounds in...

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

View source: R/tableColVal.R

Description

Table with numbers and corresponding color in the background of each cell. (heatmap)

Usage

1
2
3
tableColVal(mat, main = deparse(substitute(mat)), nameswidth = 0.3,
  namesheight = 0.1, palette = seqPal(100), Range = range(mat, finite =
  TRUE), digits = 2, classargs = NULL, cellargs = NULL, ...)

Arguments

mat

Matrix with values and row/column names

main

Title for topleft space. DEFAULT: name of mat object.

nameswidth

Relative width of row names at the left, as a percentage of plot. DEFAULT: 0.3

namesheight

Relative height of column names at the top. DEFAULT: 0.1

palette

Color palette for the heatmap. DEFAULT: seqPal(100)

Range

Range mapped to color palette. DEFAULT: range(mat)

digits

Number of digits rounded to for writing. DEFAULT: 2

classargs

List of arguments specifying how to call classify, e.g. method. DEFAULT: NULL

cellargs

List of arguments passed to text only for the cells.

...

Further arguments passed to all text like cex, col, srt, ...

Details

Create tables with corresponding color in the background of each cell. (heatmap)

Value

List of locations in plot.

Author(s)

Berry Boessenkool, berry-b[email protected], Nov 2012 + Nov 2016

See Also

pdf, heatmap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Bsp <- matrix(c(21,23,26,27, 18,24,25,28, 14,17,23,23, 16,19,21,25), ncol=4, byrow=TRUE)
colnames(Bsp) <- paste0("Measure", LETTERS[1:4])
rownames(Bsp) <- paste("prod", 8:11, sep="_")
Bsp

(  tableColVal(Bsp)   )
tableColVal(Bsp, nameswidth=0.1) # relative to plot width
tableColVal(Bsp, namesheight=0.5, srt=45)

tableColVal(Bsp, cellargs=list(cex=2), col="red")
tableColVal(Bsp, Range=c(10,40))
tableColVal(Bsp, Range=c(20,40))
tableColVal(Bsp, palette=heat.colors(12))
tableColVal(Bsp, palette=c(2,4,7), main="more\nstuff")

Bsp2 <- matrix(rexp(30), ncol=6, byrow=TRUE)
(  tableColVal(Bsp2)  )
tableColVal(Bsp2, digits=4)
colPointsLegend(Bsp2, horizontal=FALSE, x1=0.05, x2=0.15, y1=0.1, y2=0.8, title="")

## Not run: 
## Rcmd check --as-cran doesn't like to open external devices such as pdf,
## so this example is excluded from running in the checks.
pdf("TableColVal.pdf", height=5);  tableColVal(Bsp);  dev.off()
system2("open", "TableColVal.pdf")
unlink("TableColVal.pdf")

## End(Not run)

berryFunctions documentation built on May 30, 2017, 6:27 a.m.