inst/visu/components/d3-plugins/cubehelix/README.md

An interpolator that implements Dave Green’s cubehelix color scheme.

See bl.ocks.org/11413789 and bl.ocks.org/11415064 for examples.

# d3.interpolateCubehelix(a, b)

Returns a cubehelix interpolator between the two colors a and b, using a gamma correction value of 1. The two colors are typically specified in HSL color space. For example, the default cubehelix color scheme is:

var cubehelix = d3.interpolateCubehelix("hsl(300,50%,0%)", "hsl(-240,50%,100%)");

The hue of color a determines the starting hue angle in degrees, while the hue of color b determines the ending hue angle in degrees; the hue angle is interpolated linearly for intermediate values. Likewise for saturation and lightness, which are specified in percentages. (The d3.hsl constructor can also be used.)

If either color a or b is not an HSL color, the colors are converted to HSL color space first. However, it is recommended that you specify each color’s hue, saturation and lightness explicitly: cubehelix interpolation does not actually use the HSL color space, and thus the terms hue, saturation and lightness here are similar but slightly different to their meaning in HSL color space.

The return value of the interpolator is a hexadecimal RGB string.

To convert from the original color scheme’s START, ROTS and HUE parameters, use the following equalities:

For example, the default color scheme’s settings are:

These correspond to the following start and end colors:

While the original cubehelix color scheme always uses the full range of lightness from 0% to 100%, note that it is possible in this interpolator to use a subset of this range by specifying start and end colors with different lightnesses.

# d3.interpolateCubehelix.gamma(gamma)

Returns a cubehelix interpolator factory with the specified gamma correction value. For example, to create the default cubehelix color scheme with a gamma correction value of 1.2:

var cubehelix = d3.interpolateCubehelix.gamma(1.2)("hsl(300,50%,0%)", "hsl(-240,50%,100%)");

# d3.scale.cubehelix

Constructs a new linear scale with the interpolator d3.interpolateCubehelix, the domain [0, 1] and the range [hsl(300°, 50%, 0%), hsl(-240°, 50%, 100%)]. This is merely a convenience function.



jwist/visualizeR documentation built on Dec. 1, 2019, 5:11 p.m.