plotColorAnn: Adds color annotation to plot

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

plotColorAnnR Documentation

Adds color annotation to plot

Description

Plots annotation in margins, supposed to be used with image (or imageWithText)

Usage

plotColorAnn(
  centers,
  labs,
  cex = 0.7,
  cols = NULL,
  horis = FALSE,
  spacer = 0.1
)

Arguments

centers

coordinates along dimension to be annotated (centers)

labs

list of character vectors of labels or matrix of columns. Each item in the list results in one annotation. List names will be used to label annotation.

cex

width (in lines) of each annotation (0.7 is default)

cols

list of named color vectors specifying colors for each label, should have same length as labs. Generated by char2col if NULL

horis

logical, whether annotation should be horizontal or vertical

spacer

spacer (in lines) between plot and annotation

Examples

par(mgp=c(3,2,1.5))
image(1:5,1:2,matrix(1:10,ncol=2))
plotColorAnn(1:5,list(a1=c(1,1,2,3,3),a2=c('a','b','a,','b','a')),horis=T)
plotColorAnn(1:2,cbind(y1=c(1,2),y2=c('a','a')),horis=F)

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