Functions for creating a vector of colors from pre-speficied palettes.
Usage
jet.colors(n)
spectral.colors(n)
bl2gr.colors(n)
Arguments
n
a numerical value specifying the number of colors in the palette.
Details
jet.colors() creates a palette of colors which tend to have high brightness and not uniform luminance. Furthermore, the brightest colors, yellow and cyan, are used for intermediate data values, and this has the effect of emphasizing uninteresting (and arbitrary) values while demphasizing the extremes. For these reasons this popular palette is not recommended. spectral.colors() creates a palette based on ColorBrewer http://colorbrewer2.org, so the resulting colors have a much uniform luminance.
The bl2gr.colors() palette returns a palette of colors from blue to green.
Value
Returns a character vector of colors encoded in hexadecimal values.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GA)
Loading required package: foreach
Loading required package: iterators
Package 'GA' version 3.0.2
Type 'citation("GA")' for citing this R package in publications.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GA/palettes.Rd_%03d_medium.png", width=480, height=480)
> ### Name: palettes
> ### Title: Colors palettes
> ### Aliases: jet.colors spectral.colors bl2gr.colors
> ### Keywords: hplot
>
> ### ** Examples
>
> jet.colors(9)
[1] "#00007F" "#0000FF" "#007FFF" "#00FFFF" "#7FFF7F" "#FFFF00" "#FF7F00"
[8] "#FF0000" "#7F0000"
> spectral.colors(9)
[1] "#2B83BA" "#6BB0AF" "#ABDDA4" "#D4EEB1" "#FFFFBF" "#FED690" "#FDAE61"
[8] "#EA633E" "#D7191C"
> bl2gr.colors(9)
[1] "#073F80" "#0862A6" "#2582B9" "#42A4CB" "#67BFCB" "#8DD2BE" "#B1E0B8"
[8] "#CEECC7" "#DFF2DA"
>
> par(mfrow = c(3,1), mar = c(1,1,1,1))
> n = 21
> image(1:21, 1, as.matrix(1:21), col = jet.colors(21),
+ ylab = "", xlab = "", xaxt = "n", yaxt = "n", bty = "n")
> image(1:21, 1, as.matrix(1:21), col = spectral.colors(21),
+ ylab = "", xlab = "", xaxt = "n", yaxt = "n", bty = "n")
> image(1:21, 1, as.matrix(1:21), col = bl2gr.colors(21),
+ ylab = "", xlab = "", xaxt = "n", yaxt = "n", bty = "n")
>
>
>
>
>
> dev.off()
null device
1
>