hilbertDefaultPalette {HilbertVis} | R Documentation

## Default palette for Hilbert curve visualization

### Description

Calculates a colour palette of length `size`. This palette is used as default by `hilbertDisplay` (in the "HilbertVisGUI" package) and also useful for `hilbertImage` (see example there).

### Usage

    hilbertDefaultPalette( size, asArray=TRUE )

### Arguments

`size` | The number of desired colours.
`asArray` | Whether to return an array of RGB values or a character vector of color specs.

### Value

* if `asArray=TRUE` (default): An array with 3 rows and `size` columns, containing RGB values. This is the same format as returned by `col2rgb`.
* if `asArray=FALSE`: A character vector of color specs, suitable to be passed to the `col` argument of `plot`.

### Author(s)

Simon Anders, EMBL-EBI, sanders@fs.tum.de

### Examples

    # Get a palette
    palette <- hilbertDefaultPalette(30)
    # Transform from RGB triples to color strings (i.e., do the
    # reverse of col2rgb)
    colors <- apply( palette, 2, function(a) rgb(a[1], a[2], a[3], max=255) )
    # Plot the palette
    plot.new()
    plot.window( xlim=c(.5,30.5), ylim=c(0,1) )
    rect( 1:30-.5, 0, 1:30+.5, 1, col=colors )

[Package HilbertVis version 1.0.2 Index]