cubehelix | R Documentation |
cubehelix
returns set of RGB colours, which are screen display of intensity images
cubehelix(n, value = numeric(), weak = NA, rich = NA, rotate = NA, hue = NA, gamma = 1,
dark = NA, light = NA, bright = NA, inv = NA, verbose = NA)
n |
Positive integer. Length of returned color vector. If |
value |
Numeric vector of values, which are associated with a palette. If both positive and negative values are in this vector, then divergence color palette is returned. Default in numeric of length zero (unspecified). |
weak |
Numeric. The angle (in degrees) of the helix for color with |
rich |
Numeric. The angle (in degrees) of the helix for color with |
rotate |
Numeric. The angle of rotation (in degrees) of the helix over the scale; can be negative. If |
hue |
Non-negative numeric. Saturation of color. |
gamma |
Numeric. Power of intensity. Intensity is between |
dark |
Positive numeric in interval between 0 and 255. The intensity of the darkest color in the palette. For light backgrounds default is 63. For dark backgrounds default is 14 (inverse order with |
light |
Positive numeric in interval between 0 and 255. The intensity of the lightest color in the palette. For light backgrounds default is 241, for dark backgrounds default is 192 (inverse order with |
bright |
Positive numeric in interval between 0 and 255. Value for equal intensity for |
inv |
Logical. Inversion of color intensity. If |
verbose |
Logical. Value |
This is modified source code of function cubeHelix()
from package rje under GPL>=2 license.
The palette design is oriented that figures can be printed on white paper. Under this assumption, light color is for small values, and dark color is for big values. In some computer vision and GIS software black background is used, and in this case light color for big values, and dark color of small values looks more naturally. For some thematic maps big values are light, and small values are small (for example, sea ice concentration: open water is blue, close ice is white). RGB and Grayscale remote sensing and photo imagery use light colors for strong signal, and dark colors for weak signal.
Light background is default for figure (specified by argument background
in function compose_open
).
The palette divergency can be defined only if value
is specified. If all values are positive, or all values are negative, then returned palette is not drivergent. For divergent palettes the helix sequence is continuous.
If dark
and lihgt
are unspecified, the color contrast bewteen dark
and light
drops on reducing number of colors in returned vector.
Vector of RGB color specification.
Dave Green, Robin Evans
Dave Green
Robin Evans
Nikita Platonov platonov@sevin.ru
Dave Green's ‘cubehelix’ colour scheme.
Green, D. A., 2011, ‘A colour scheme for the display of astronomical intensity images’, Bulletin of the Astronomical Society of India, 39, 289. http://astron-soc.in/bulletin/11June/289392011.pdf (pre-print at 'arxiv.org')
rje::cubeHelix()
; rje at CRAN: https://CRAN.R-project.org/package=rje
session_grid(NULL)
set.seed(352)
session_grid(regrid(mul=1/16))
a <- ursa_dummy(3,min=0,max=255)
b4 <- b3 <- b2 <- b1 <- vector("list",length(a))
for (i in seq_along(b1)) {
b1[[i]] <- colorize(a[i],pal=cubehelix(11,weak=45*i,rotate=+270),ncolor=11)
b2[[i]] <- colorize(a[i],pal=cubehelix(11,weak=45*i,rotate=-270),ncolor=11)
b3[[i]] <- colorize(a[i]-127,pal=cubehelix)
hue <- sample(seq(2)-1,1)
s <- ifelse(hue==0,NA,runif(1,min=91,max=223))
b4[[i]] <- colorize(a[i]-127,pal=cubehelix,pal.hue=hue,pal.dark=s,pal.light=s)
}
display(c(b1,b2),layout=c(2,NA),decor=FALSE)
display(c(b3,b4),layout=c(2,NA),decor=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.