Learn R Programming

compEpiTools (version 1.6.3)

palette2d: build a two dimensional color palette

Description

build a two dimensional color palette

Usage

palette2d(n, k, col1='white', col2='orange', col3='red')

Arguments

n
numeric
k
numeric
col1
character; a color, the lower limit of the color palette
col2
character; a color, the mid point of the color palette
col3
character; a color, the upper limit of the color palette

Value

Details

A bidimensional color palette is built. First a set1 of round(n/2) colors ranging from col1 and col2 is defined. Then a set2 of round(n/2) colors ranging from col2 and col3 is defined. Set1 and set2 are concatenated, as the first row of a k X n matrix M. Finally, for each column i of M, k colors ranging from white to M[1,i] are defined.

It is used in the GRheatmapPlot function to have a color palette simultaneously representing the intensity of an event (n) and its significance (k). See the example.

References

http://genomics.iit.it/groups/computational-epigenomics.html

Examples

Run this code
res <- palette2d(50, 10)
plot(rep(1:ncol(res),each=nrow(res)), rep(1:nrow(res),times=ncol(res)), col=res, 
	pch=20, xlab='intensity', ylab='significance')

Run the code above in your browser using DataLab