g2r.colors: Palette from green to red via black

Description Usage Arguments Details Value See Also Examples

View source: R/annHeatmap.R

Description

Returns a color vector of the requested length, ranging from pure red to pure green via slighlty tinted black.

Usage

1
g2r.colors(n = 12, min.tinge = 0.33)

Arguments

n

the number of requested colors

min.tinge

the proportion of red/green added to black to make it recognizably green or red

Details

If n is even, the colors range from pure green to green-tinted black to red-tinted black to pure red. If n is odd, the colors range from pure red to pure green, with full black for the median class.

Value

A vector of (RGB-) colors of the specified length

See Also

breakColors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    ## Even number: residual tint shows left/right of center
    co_even = g2r.colors(10)
    co_even
    doLegend(1:11, co_even, 1)
    
    ## Odd number: central class all black
    co_odd = g2r.colors(9)
    co_odd
    doLegend(1:10, co_odd, 1)

    ## Lighter tint in the middle
    co_light = g2r.colors(10, min.tinge=0.50)
    co_light
    doLegend(1:11, co_light, 1)

Heatplus documentation built on May 2, 2018, 4:03 a.m.