Heatmap with control over the aspect ratio

Description

This function replaces the heatmap function in the stats package with a function with additional features. First, the user can specify an aspect ratio instead of being forced to accept a square image even when the matrix is not square. Second, the user can overlay horizontal or vertical lines to mark out important regions.

Usage

 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
29
aspectHeatmap(x,
              Rowv=NULL,
              Colv=if (symm) "Rowv" else NULL,
              distfun=dist,
              hclustfun=hclust,
              reorderfun=function(d, w) reorder(d, w),
              add.expr,
              symm=FALSE,
              revC=identical(Colv, "Rowv"),
              scale=c("row", "column", "none"),
              na.rm=TRUE,
              margins=c(5, 5),
              ColSideColors,
              RowSideColors,
              cexRow=0.2 + 1/log10(nr),
              cexCol=0.2 + 1/log10(nc),
              labRow=NULL,
              labCol=NULL,
              main=NULL,
              xlab=NULL,
              ylab=NULL,
              keep.dendro=FALSE,
              verbose=getOption("verbose"),
              hExp=1,
              wExp=1,
              vlines=NULL,
              hlines=NULL,
              lasCol=2,
              ...)

Arguments

x

See documentation for heatmap.

Rowv

See documentation for heatmap.

Colv

See documentation for heatmap.

distfun

See documentation for heatmap.

hclustfun

See documentation for heatmap.

reorderfun

See documentation for heatmap.

add.expr

See documentation for heatmap.

symm

See documentation for heatmap.

revC

See documentation for heatmap.

scale

See documentation for heatmap.

na.rm

See documentation for heatmap.

margins

See documentation for heatmap.

ColSideColors

See documentation for heatmap.

RowSideColors

See documentation for heatmap.

cexRow

See documentation for heatmap.

cexCol

See documentation for heatmap.

labRow

See documentation for heatmap.

labCol

See documentation for heatmap.

main

See documentation for heatmap.

xlab

See documentation for heatmap.

ylab

See documentation for heatmap.

keep.dendro

See documentation for heatmap.

verbose

See documentation for heatmap.

hExp

height expansion factor (default is 1)

wExp

width expansion factor (default is 1)

vlines

vector of positions at which to draw vertical lines

hlines

vector of positions at which to draw horizontal lines

lasCol

axis label style (las) for columns

...

additional arguments passed along to the image command

Details

The new arguments hExp and wExp are "expansion factors" for the height and width of the figure, respectively. They are used to alter the arguments passed to the layout function internally to heatmap.

The new arguments hlines and vlines are used to specify points at which horizontal or vertical lines, respectively, should be overlaid on the image.

Value

The same as the heatmap function.

Author(s)

Kevin R. Coombes krc@silicovore.com

See Also

heatmap

Examples

1
2
3
4
5
6
nC <- 30
nR <- 1000
fakeData <- matrix(rnorm(nC*nR), ncol=nC, nrow=nR)
aspectHeatmap(fakeData, scale='none', hExp=2, wExp=1.4, margins=c(6,3))
aspectHeatmap(fakeData, scale='none', hExp=2, wExp=1.4, margins=c(6,3),
              vlines=15.5, hlines=c(100, 300))