imageWithText: Plot heatmap with numbers

View source: R/general.purpuse.utilities.R

imageWithTextR Documentation

Plot heatmap with numbers

Description

Wraps image functions

Usage

imageWithText(
  d,
  t = NULL,
  digits = 2,
  text.col = NULL,
  xaxlab = rownames(d),
  yaxlab = colnames(d),
  centerColors0 = FALSE,
  las = 2,
  text.xadj = 0.5,
  colAnns = NULL,
  rowAnns = NULL,
  colAnnCols = NULL,
  rowAnnCols = NULL,
  col = hcl.colors(100, "YlOrRd", rev = TRUE),
  rowAnnWidth = 0.7,
  colAnnWidth = 0.7,
  annSpacer = 0.1,
  ...
)

Arguments

d

matrix to be plotted

t

text to be ploted on top of image (rounds d by default)

digits

number of digits retained under rounding of d

text.col

color for text

xaxlab, yaxlab

axis labels, dimnames(d) by default

centerColors0

logical, specifies whether 0 should be considered as palette center (makes sense for correlation matrices)

las

orientation of axis labels (see las in ?par)

text.xadj

text adjastment by x

colAnns, rowAnns

list (or matrix of columns) of column (row) annotation to be shown by color

rowAnnWidth, colAnnWidth
  • size of colour annotations as fraction of plot area

annSpacer
  • spacer between heatmap and annotation as fraction of plot area

...

other options to be supplied to image

colAnnsCols, rowAnnsCols
  • colors to be used for col (row) annotation. Defined by char2color if null.

legend.cex.at, legend.col.at

values to be used in legend, set both to have two independent legends for size and colour

legend.cex.title, legend.col.title

titles of legends

Examples

par(mar=c(10,6,1,1),bty='n')
imageWithText(mtcars[1:4,1:3],rowAnns=list(r1=c(1,1,2),r2=c('a','a','a')),rowAnnCols=list(r1=c('1'='red','2'='blue'),r2=c(a='green')),colAnns = list(c1=c(1,1,1,2),c2=c(2,1,2,1),c3=c('a','b','b','b')))

iaaka/visutils documentation built on Jan. 17, 2025, 11:29 p.m.