guessWH: Guess width and height parameters for a heatmap

View source: R/biosHeatmap.R

guessWHR Documentation

Guess width and height parameters for a heatmap

Description

guessWH helps biosHeatmap determines a proper canvas dimension as well as the proportion between legends and the main figure, especially in the command line mode.

Usage

guessWH(
  nrow,
  ncol,
  rownames,
  colnames,
  cexRow,
  cexCol,
  xlab,
  ylab,
  width,
  height
)

Arguments

nrow

Row count of the matrix to be visualized

ncol

Column count of the matrix to be visualized

rownames

Row names of the matrix, helping to determine horizontal margins. Can be missing or set as NULL

colnames

Column names of the matrix, helping to determine vertical margins. Can me missing or set as NULL

cexRow

Row name font size. Can be missing or NA.

cexCol

Column name font size. Can be missing or NA.

xlab

X-axis (column side) name. Character string. Can be missing or NA

ylab

Y-axis (row side) name. Character string. Can be missing or NA

width

Width suggested by the user. Can be NA

height

Height suggested by the user. Can be NA

Details

guessWH determines for visual purposes the best height/width and legend/figure proportion for heatmaps. Interested users are invited to read the codes to get insights how the task is done.

Value

A list of width proportions, height proportions, the total width and the total length.

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

See Also

biosHeatmap

Examples


myMat <- matrix(rnorm(256), nrow=16)
rownames(myMat) <- sample(paste(letters, LETTERS, sep="_"),16)
colnames(myMat) <- sample(paste(LETTERS, letters, sep="_"), 16)
guessWH(nrow=nrow(myMat), ncol=ncol(myMat), width=4, height=4)
guessWH(nrow=nrow(myMat), ncol=ncol(myMat), width=NA, height=NA)
myWH <- guessWH(nrow=nrow(myMat), ncol=ncol(myMat),
xlab="321", ylab="ABC",
rownames=rownames(myMat), colnames=colnames(myMat))

if(interactive()) {
X11(width=myWH$width, height=myWH$height)
biosHeatmap(myMat, lwid=myWH$lwid, lhei=myWH$lhei, xlab="321",
ylab="ABC", cexRow=2L, cexCol=2L)
dev.off()
}



bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.