| Type: | Package |
| Title: | Builds Color Tables |
| Version: | 2.3.4 |
| Date: | 2024-03-05 |
| Description: | Builds gradient color maps. |
| License: | GPL-2 | GPL-3 [expanded from: GPL] |
| NeedsCompilation: | no |
| Packaged: | 2024-03-06 18:36:15 UTC; jefferis |
| Author: | Tim Keitt |
| Maintainer: | Gregory Jefferis <jefferis@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2024-03-07 00:00:07 UTC |
Builds color maps
Description
This (v2) is a rewrite of the colorRamps package. It now contains two
function table.ramp and rgb.tables that
allow easy construction of color palettes. This version contains two new
palettes similar to the Matlab default palette (matlab.like
and matlab.like2).
I built colorRamps because I needed to use a particular palette and got
tired of sourcing in my code into every session. Now I can install and
forget. Despite using R for years, I had not noticed the alternative
colorRamp which may suit your needs. If you want really
attractive palettes, get the RColorBrewer package from CRAN. For certain
applications the RColorBrewer palettes do not work for me, hence this
package.
Details
| Package: | colorRamps |
| Type: | Package |
| Version: | 2.0 |
| Date: | 2007-09-09 |
| License: | GPL |
Most functions take a single argument n that specifies the number of colors to generate.
Author(s)
Tim Keitt
Maintainer: Tim Keitt <tkeitt@gmail.com>
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
Examples
filled.contour(volcano, col = ygobb(21), asp = 1)
Returns a gradient color map
Description
blue2red makes a color map that runs from blue -> cyan ->
yellow -> red.
blue2green makes a color map that runs from blue -> magenta ->
yellow -> green.
green2red makes a color map that runs from green -> cyan ->
magenta -> red
Usage
blue2red(n)
blue2green(n)
green2red(n)
Arguments
n |
number of colors |
Details
These are double-ramp maps with a sharp transition from cooler colors to warmer colors at the midpoint. With proper scaling, this will highlight the mean, median, etc.
Value
A colormap
Author(s)
Tim Keitt <tkeitt@gmail.com>
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
See Also
Examples
image(matrix(1:400, 20), col = blue2red(400))
image(matrix(1:400, 20), col = blue2green(400))
image(matrix(1:400, 20), col = green2red(400))
Returns a gradient color map
Description
blue2yellow makes a blue to yellow gradient color map
Usage
blue2yellow(n)
cyan2yellow(n)
magenta2green(n)
Arguments
n |
number of colors |
Details
These are single gradient maps that smoothly transition from cooler
to
warmer colors. See blue2red for double gradient maps.
Value
A color map
Author(s)
Tim Keitt <tkeitt@gmail.com>
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
See Also
Examples
image(matrix(1:400, 20), col = blue2yellow(400))
Generate color palettes similar to the matlab default
Description
Generates matlab-like color palettes
Usage
matlab.like(n)
matlab.like2(n)
blue2green2red(n)
Arguments
n |
number of colors |
Details
blue2green2red is simply an alias for
matlab.like2.
Value
a color palette
Author(s)
Timothy H. Keitt
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
Examples
image(matrix(1:400, 20), col = blue2yellow(400))
generates expanded sets of primary colors
Description
Combines red, green and blue values to create primary colors
Usage
primary.colors(n, steps = 3, no.white = TRUE)
Arguments
n |
number of colors to generate (optional) |
steps |
number of rgb intensity levels |
no.white |
boolean indicating whether to return white |
Details
The standard R palette only provides 8 colors after which colors are recycled. If you need a few more colors that are redily distinguished in multivariate plots, this function can help.
Value
An R color palette
Author(s)
Timothy H. Keitt
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
Examples
x <- matrix(rnorm(100), 10)
x <- sapply(1:10, function(i, x) cumsum(x[,i]), x=x)
par(mfrow = c(1, 2))
matplot(1:10, x, type = 'l', lty = 1, lwd = 3)
matplot(1:10, x, type = 'l', lty = 1, lwd = 3, col = primary.colors(10))
constructs color palettes with sharp breaks
Description
rgb.tables wraps table.ramp and simply passes values
supplied in the red, green and blue
arguments. table.ramp makes a color ramp with a flat top.
Usage
rgb.tables(n, red = c(0.75, 0.25, 1), green = c(0.5, 0.25, 1), blue =
c(0.25, 0.25, 1))
table.ramp(n, mid = 0.5, sill = 0.5, base = 1, height = 1)
Arguments
n |
number of colors to generate |
red |
a length 3 vector with values |
green |
same as |
blue |
same as |
mid |
table center on (0, 1) |
sill |
width of table top on (0, 1) |
base |
width of table base on (0, 1) |
height |
sill height on (0, 1) |
Value
rgb.tables returns a color palette. table.ramp returns a
simple vector of values.
Author(s)
Timothy H. Keitt
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
See Also
Examples
table.ramp(10)
rgb.tables(10)
Returns a gradient color map
Description
ygobb makes a color map that runs from yellow -> green ->
olive -> blue -> black.
Usage
ygobb(n)
Arguments
n |
number of colors |
Details
I am still working on this one.
Value
A colormap
Author(s)
Tim Keitt <tkeitt@gmail.com>
References
Keitt, T. H. (2008) Coherent ecological dynamics induced by large scale disturbance. Nature 454:331-334
See Also
Examples
image(matrix(1:400, 20), col = ygobb(400))