hilbertDefaultPalette {HilbertVis} | R Documentation |
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).
hilbertDefaultPalette( size, asArray=TRUE )
size |
The number of desired colours. |
asArray |
Whether to return an array of RGB values or a character vector of color specs. |
* 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
.
Simon Anders, EMBL-EBI, sanders@fs.tum.de
# 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 )