imageWithScale: Plot a matrix as a heatmap in its natural orientation, with a...

View source: R/plotting.R

imageWithScaleR Documentation

Plot a matrix as a heatmap in its natural orientation, with a colored scale on the right side, and optionally using its dimension names for rows and columns

Description

To print all row names, choose idx.rownames=1:nrow(z). To print a subset of 10 row names, choose idx.rownames=floor(seq(1, nrow(z), length.out=10)). Similarly for column names.

Usage

imageWithScale(
  z,
  main = NULL,
  idx.rownames = NULL,
  idx.colnames = NULL,
  breaks = NULL,
  nb.breaks = 20,
  left.text.at = NULL,
  cex.txt = 1,
  cex.sc = 1,
  col.pal = grDevices::colorRampPalette(c("black", "red", "yellow"), space = "rgb"),
  custom.mar = NULL
)

Arguments

z

matrix to be plotted

main

title to appear above the heatmap

idx.rownames

vector giving the indices of the row names of z to be added on the left side of the plot

idx.colnames

vector giving the indices of the column names of z to be added on top of the plot

breaks

vector of breaks (if NULL, will be seq(min(z), max(z), length.out=nb.breaks))

nb.breaks

number of breaks

left.text.at

vector which names and values will be used to label the left side of the plot; if not NULL, takes precedence over idx.rownames

cex.txt

numeric character expansion factor used with "left.text.at"

cex.sc

numeric character expansion factor used with the scale

col.pal

output of colorRampPalette

custom.mar

see par

Author(s)

Timothee Flutre

Examples

## Not run: set.seed(1859)
genomes <- simulCoalescent(nb.inds=200, nb.pops=3, mig.rate=3)
X <- genomes$genos
A <- estimGenRel(X=X, relationships="additive", method="vanraden1")
imageWithScale(z=A, main="Additive genetic relationships", breaks=seq(0,1,length.out=20),
               left.text.at=setNames(c(0.83, 0.5, 0.17), c("pop1", "pop2", "pop3")))

## End(Not run)

timflutre/rutilstimflutre documentation built on Aug. 18, 2024, 7:43 p.m.