mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

vis/color/

mg_cubehelix.pro

includes main-level program

Routines

top mg_cubehelix

mg_cubehelix [, start=float] [, rotations=float] [, hue=float] [, gamma=float] [, ncolors=int] [, rgb_table=bytarr(256, 3)]

Calculate a "cube helix" color table and set the current direct graphics color table (unless RGB_TABLE is present). Based on the FORTRAN 77 code provided in D.A. Green, 2011, BASI, 39, 289.

From the example code in the paper: "Calculates a 'cube helix' colour table. The colors are a tapered helix around the diagonal of the [R, G, B] color cube, from black [0,0,0] to white [1, 1, 1]. Deviations away from the diagonal vary quadratically, increasing from zero at black, to a maximum, then decreasing to zero at white, all the time rotating in colour."

With the defaults, the cube helix color table looks like:

With ROTATIONS=-1., the cube helix color table looks like:

Keywords

start in optional type=float default=0.5

start color (1=red, 2=green, 3=blue), e.g., 0.5=purple

rotations in optional type=float default=-1.5

rotations in color, typically -1.5 to 1.5, e.g., -1.0 is one blue to green to red cycle

hue in optional type=float default=1.0

hue intensity scaling, in the range 0 (BW) to 1; to be strictly correct, larger values may be OK with particular start/end colors

gamma in optional type=float default=1.0

set the gamma correction for intensity

ncolors in optional type=int default=!d.table_size

number of colors to output

rgb_table out optional type=bytarr(256, 3)

set to a named variable to retrieve the color table as an array containing the color table values instead of setting the current color table

Examples

Create the default cube helix color table and display it in a direct graphics window:

IDL> mg_cubehelix IDL> device, decomposed=0 IDL> tv, bindgen(256) # (bytarr(10) + 1B)

Author information

History:

Derived from James R.A. Davenport's CUBEHELIX routine

File attributes

Modification date: Wed May 14 15:07:15 2014
Lines: 44
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.