Note: from 2024 January my webpages, previously hosted on https://www.mrao.cam.ac.uk/~dag/, are now being hosted on https://people.phy.cam.ac.uk/dag9/ instead. Please revise any bookmarks/links pointing to the old webpages.

Dave Green's ‘cubehelix’ colour scheme

Note: if you use this colour scheme in a paper, then please cite my Green (2011) paper.

Contents:

  1. 1) Background: The Problem
  2. 2) A Solution
  3. 3) Implementations
  4. 4) Artisitic uses. new
Or you can try to make your own, using javascript.
VGPS of G35.6-0.4 region

Example images using the ‘cubehelix’ colour scheme using AIPS. (left) A portion of the Galactic plane from the VGPS survey at 1.4 GHz, which includes the supernova remnant G35.6-0.4 (see: 2009MNRAS.399..177G). (right) The Crab Nebula at 347 GHz observed with SCUBA on the JCMT (see 2004MNRAS.355.1315G).


SCUBA image of the Crab Nebula

Other examples elsewhere: (1) the Sun; (2) edge detection; (3) (a) optical images of Comet Lovejoy (C/2014 Q2), (b) Barnard's Loop in Orion, (c) the Horsehead Nebula, and (d) a galaxy with lensed arcs; (4) particulate polution. (5) two images of fractals: (a) Mandelbrot, and (b) generalized Newton; (6) some geographical images (a) various; (b) of elevation of Europe and surroundings, (c) and (d) elevation for smaller regions; (7) the Mona Lisa.

CubeHelix Example Image
...

1) Background: The Problem

Many colour schemes used to display astronomical intensity images do not have an underlying increase in the perception of the brightness of the colours used (e.g. burning out to red for the high data values, but using yellow/green for intermediate data values, which are perceived as being brighter than the red).


2) A Solution

I have written up the implementation of a colour scheme – called ‘cubehelix’ – which is intended to be perceived as increasing in intensity. This is a family of colour schemes that go from black to white, deviating away from a pure greyscale (i.e. the diagonal from black to white in a colour cube) using a tapered helix in the colour cube, while ensuring a continuous increase in perceived intensity. The deviation from the diagonal takes into account that red, green and blue are not perceived equally in terms of intensity. These colour schemes print as a monotonically increasing greyscale on black and white postscript devices.

This colour scheme is described in more detail in:

Green, D. A., 2011, ‘A colour scheme for the display of astronomical intensity images’, Bulletin of the Astronomical Society of India, 39, 289.

(2011BASI...39..289G at ADS.)

Please cite this paper if you use ‘cubehelix’ in any publications.

This colour scheme is now recommended in the Graphics Guide for authors from the American Astronomical Society (although, rather strangely, they decided to call it ‘cube-helix’ with a hyphen).

There is no single ‘cubehelix’, as there are several parameters that control this family of colour schemes:

  1. the ‘start’ colour (this is the direction of the predominant colour deviation from black at the start of the colour scheme, with R=1, G=2, B=3 etc.);
  2. the ‘number’ of R → G → B rotations that are made from the start (i.e. black) to the end (i.e. white) of the colour scheme;
  3. a ‘hue’ parameter, which controls how saturated the colour of all hues are (if this parameter is zero then the colour scheme is purely a greyscale; if the parameter is larger than 1, then some R, G or B values may be out of range near the start or end colour scheme, so will have to be clipped, although if only a few colour levels are clipped, the resulting colour scheme may still be satisfactory);
  4. a ‘gamma factor’ can be used to emphasise low or high intensity values.

Whatever the parameters, the colour scheme is from black to white, i.e. it uses a the full range of the intensity available. This is in contrast to both the matplotlib viridis colour scheme (the default since version 2.0), and the Matlab parula colour scheme (the default since version R2014b), which are from dark blue/purple to a yellow, so only use about 70% of the full intensity range available.

2.1) Some Examples

2.1.1) My ‘default’

The image below shows what I consider my ‘default’ scheme.

my `default' cubehelix colour scheme

And here is a 3-D visualisation of how the colour scheme spirals around the diagonal of the colour cube.

my `default' cubehelix colour scheme 3D

2.1.2) With more colour

Note that since this ‘default’ scheme uses a hue parameter of 1, no R, G or B values are clipped, and the perceived intensity is constantly increasing. If the hue parameter is increased, then the scheme becomes more colourful, but some of the R, G or B values are clipped (although the underlying perception of intensity is not exactly constantly increasing, it is still monotonically increasing). Below is a ‘more hue’ scheme, for a hue parameter of 1.5.

a `more hue' cubehelix colour scheme

2.2) Other Examples

As this colour scheme has several paramaters, there are alternative versions you can use/make if you do not like the default version. Several people have said they do not like the ‘default’ scheme above, with so much pink. Instead, reducing the number of rotations to −1 gives:

a cubehelix colour scheme with
less rotation

or changing the start colour to 1.5 gives:

a cubehelix colour scheme with
less rotation

This page gives several other colour wedges made with different parameters (along with the corresponding colour scheme files for use in DS9 or kvis, see below).

Or you can make your own – using javascript – to visualise what other combinations of parameters produce, and also produce colour scheme files for DS9, or R/G/B values as decimal or hex numbers (I believe this works in Firefox, Safari, Chrome and Edge, but not with IE).


3) Implementations

3.1) Fortran

As in the published paper, here is the Fortran 77 source of a subroutine that implements this scheme, which is free software released into the public domain, under the unlicense license.

3.2) Astronomical packages (AIPS / casa / DS9 / karma kvis / miriad / CIAO / PSRchive / HEALpix / APT)

This scheme is also implemented in:

3.3) Other implementations

Other implementations I know of are:

If you have another implementation, please let me know if you want it listed here.


4) Artistic uses


home | addresses | teaching | research


Valid HTML 4.01!