Function Repository Resource:

# CubehelixColorFunction

Generate color functions using the "cubehelix" method

Contributed by: Cody Woodard (Wolfram Research)
 ResourceFunction["CubehelixColorFunction"][options] generate a "cubehelix" color function based on given options.

## Details and Options

The following options can be given:
 "Start" 1/2 beginning hue "Rotations" -3/2 cycles of all hues "Hue" 1 colorfulness of median values "Gamma" 1 emphasis on higher/lower values "MinLight" 0 lightness for minimum values "MaxLight" 1 lightness for maximum values "MinHue" 0 colorfulness of extreme values
"Start" defines the starting hue of the color function, where 1 = red, 2 = green and 3 = blue. The default value (1/2) is purple.
"Rotations" defines how many times we cycle through all hues. 0 means that we only use one hue, 1 means that we cycle through all hues once and -2 means that we cycle through all hues twice but in a reverse direction. The default value (-3/2) means that we cycle through all hues one and a half times in a reverse direction.
"Hue" (which is really chroma) defines how colorful the function is. 0 means that there is no color and 1 (the default value) means that there is a default amount of color. You can use values greater than 2.6, but they will tend to be oversaturated.
"Gamma" shifts the lightness curve and should be a value greater than 0 but less than 2. The default value (1) provides a linear curve. Lower values (like 1/4) will lighten all colors but will leave low values dark. Higher values (like 3/4) will darken all colors but will leave high values light.
"MinLight" defines the lightness value for minimum values. The default value is 0, meaning that the minimum value will be black.
"MaxLight" defines the lightness value for maximum values. The default value is 1, meaning that the maximum value will be white.
"MinHue" defines how colorful the extreme values of the function will be. The default value is 0, meaning that the function will be most colorful in the middle and the minimum/maximum values will have no color.

## Examples

### Basic Examples (1)

Store and use the ColorFunction returned using default values:

 In[1]:=
 In[2]:=
 Out[2]=

### Scope (3)

Default ColorFunction used for a Plot3D:

 In[3]:=
 Out[3]=

Default ColorFunction used for an ArrayPlot:

 In[4]:=
 Out[4]=

Default ColorFunction used for a ReliefPlot:

 In[5]:=
 Out[5]=

### Options (4)

#### Start (1)

"Start" defines the starting hue of the color function, where 1 = red, 2 = green and 3 = blue:

 In[6]:=
 Out[6]=

#### Rotations (1)

"Rotations" defines how many times we cycle through all hues. 0 means that we only use one hue, 1 means that we cycle through all hues once and -2 means that we cycle through all hues twice but in a reverse direction:

 In[7]:=
 Out[7]=

#### Hue (1)

"Hue" (which is really chroma) defines how colorful the function is. 0 means that there is no color and 1 means that there is a default amount of color. You can use values greater than 2.6, but they will tend to be oversaturated:

 In[8]:=
 Out[8]=

#### Gamma (1)

"Gamma" shifts the lightness curve and should be a value greater than 0 but less than 2. The default value (1) provides a linear curve. Lower values (like 1/4) will lighten all colors but will leave low values dark. Higher values (like 3/4) will darken all colors but will leave high values light:

 In[9]:=
 Out[9]=

### Applications (3)

#### Rainbow (2)

You can use these options to create a rainbow gradient:

 In[10]:=
 Out[10]=

This is the same as if we used LCHColor directly:

 In[11]:=
 Out[11]=

#### Custom Color Functions (1)

Here are a couple of presets you might like:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

### Neat Examples (2)

#### Animated Pastels (1)

This creates an animated gradient:

 In[14]:=
 Out[14]=

#### Cubehelix Explorer (1)

You can use this manipulate to play around with the options:

 In[15]:=
 Out[15]=

## Version History

• 1.0.0 – 15 July 2019

## Author Notes

Note: This is not a faithful port of the original FORTRAN code, but a complete novel reimplementation. I have tried to match the results as closely as possible to other implementations, but it will not be exact.