Get from Ico-github-logo

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Cubehelix Colormaps: Beautiful, Distinct, Versatile!

  • cubehelix(N,start,rots,sa...
    Generate an RGB colormap of Dave Green's Cubehelix colorscheme. With range and domain control.
  • cubehelix_find(map,posn,p...
    Return parameter values for the Cubehelix colorscheme that matches the input colormap.
  • cubehelix_view(N,start,ro...
    An interactive figure for Cubehelix colormap parameter selection. With demo!
  • View all files
5.0
5.0 | 4 ratings Rate this file 50 Downloads (last 30 days) File Size: 29.3 KB File ID: #43700 Version: 2.1
image thumbnail

Cubehelix Colormaps: Beautiful, Distinct, Versatile!

by

 

30 Sep 2013 (Updated )

The most versatile colormap generator ever! Suitable for grayscale conversion. Maximally distinct.

| Watch this File

File Information
Description

This is the only colormap generator you will ever need: Cubehelix are the best colormaps for published or distributed documents!

CUBEHELIX allows you to create different colormaps using just a few parameters. The standard Cubehelix algorithm offer very attractive colorschemes for online and electronic documents (e.g. PDF), and yet when printed in grayscale they keep exactly the sequence information of the original data. CUBEHELIX also includes two extra controls over the range and domain of the Cubehelix scheme, giving a practically unlimited number of colormaps with many different styles: maximally distinct, multi or single hue, or even simple grayscale.

### Bonus Functions ###

* CUBEHELIX_FIND can be used to retrieve the parameters from an existing Cubehelix colormap, or to find the best Cubehelix colorscheme that matches any selection of colors (e.g. a document or corporate colorscheme).
* CUBEHELIX_VIEW creates a figure for creating Cubehelix colorschemes with real-time interactive adjustment of the scheme's parameter values, plus a 'random' demonstration mode. It also allows adjustment of other axes' or figures' colormaps, for example:
load spine
image(X)
cubehelix_view({gca})

### Cubehelix ###

Cubehelix colorschemes consist of nodes along a tapered helix in the RGB color cube, with a continuous increase in perceived intensity (e.g. black->white). Thus the scheme defines attractive colormaps with a huge choice of hue, saturation and brightness, and yet printing a figure (or image) in Black-and-White (e.g. postscript) results in a monotonically increasing grayscale that retains the brightness order of the original colormap. The sequence information of the colormap is retained even in grayscale, which means an attractive colored image can be printed in grayscale and still be informative to the end-user.

The scheme is defined here: http://astron-soc.in/bulletin/11June/289392011.pdf
For more information and examples: http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/

Note: The original specification (the links above) misnamed the saturation option as "hue". In this submission the saturation option is named "sat".

### Examples ###

% New colors for the COLORMAP example:
load spine
image(X)
colormap(cubehelix)

% New colors for the SURF example:
[X,Y,Z] = peaks(30);
surfc(X,Y,Z)
colormap(cubehelix([],0.5,-1.5,1,1,[0.29,0.92]))
axis([-3,3,-3,3,-10,5])

### Examples of Viewing Cubehelix Colormaps ###

% Interactive colorscheme parameter viewer:
cubehelix_view
% Set/reset the viewer with new parameter values:
cubehelix_view([],0.5,-1.5,1,1)

### Examples of Retrieving Colormap Parameters ###

cubehelix_find(cubehelix(10))
 ans = [0.5,-1.5,1,1]

map = cubehelix(10, 1.4,-0.7,0.9,1.2, [0.05,0.97]);
[vec,irg,dmn] = cubehelix_find(map)
 vec = [1.4,-0.7,0.9,1.2]
 irg = [0.05,0.97]
 dmn = [0,1]

map = cubehelix(64, [2.3,0.4,0.5,0.6], [0.05,0.24], [0.19,0.85]);
[vec,irg,dmn] = cubehelix_find(map)
 vec = [2.3,0.4,0.5,0.6]
 irg = [0.05,0.24]
 dmn = [0.19,0.85]

Acknowledgements

Light Bartlein Color Maps, Vivid Colormap, Cold Colormap, Red Blue Colormap, Haxby Color Map, Bipolar Colormap, Perceptually Improved Colormaps, Contourfcmap: Filled Contour Plot With Precise Colormap, Generate Maximally Perceptually Distinct Colors, Matlab Colormaps As Seen By Color Blind Users, Stoplight, Othercolor, Color Gradient: Generate Custom Linear Colormaps, Colormaps Compatible With Red Green Color Perception Deficiencies, Cbrewer : Colorbrewer Schemes For Matlab, Polarmap: Polarized Colormap, Build Custom Colormaps, Custom Colormap, Beautiful And Distinguishable Line Colors + Colormap, Color Brewer: Attractive And Distinctive Colormaps, Intuitive Rgb Color Values From Xkcd, Rgbmap Color Maps, Jetwhite(Colours), Hslcolormap, Color Gray, Sc Powerful Image Rendering, Perceptually Uniform Colormaps, Color Palette Tables (.Cpt) For Matlab, and Jet White inspired this file.

This file inspired Paruly, Jetwhite(Colours), Color Brewer: Attractive And Distinctive Colormaps, and Convert Between Rgb And Colornames.

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
10 May 2016 HarryDymond  
04 Sep 2015 Matthias

Excellent function. Works well, creates nice colours that do not trick the reader and prints well in gray scales. It does what it is supposed to do.

07 Feb 2015 Warwick  
05 Aug 2014 John

John (view profile)

 
Updates
14 Oct 2013 1.1

- Add range sliders to viewer.
- Slightly robuster finder algorithm.
- Show some nice examples in the illustration!

13 Jan 2014 1.2

- Allow parameters to be input as a vector.
- Improve viewer background.
- Better demonstration-mode: random examples in the viewer.

17 Mar 2014 1.3

- Improve input argument checking.
- Viewer figure now displays warnings for clipped RGB or non-monotonic grayscale values.
- Demo now also varies the range values.

07 Aug 2014 1.4

- Improve input argument checking.

30 Jan 2015 1.5

* Include Domain option.
* Include 3D RGB-cube viewer.
* More robust parameter finder.

05 Feb 2015 1.6

* Change input name from <rng> to <yrange> to avoid conflict with inbuilt function.
* Simplify input checking.
* Simplify internal passing of variables to local functions.

06 Feb 2015 1.7

* Use correct color terminology: rename "hue" -> "sat", and "start" -> "hue".

06 Feb 2015 1.8

* Minor edit to blurb, consistent parameter names.

05 Dec 2015 2.0

* Move to GitHub repository.
Changes to "cubehelix_view":
* Simplify internal graphics-handle management.
* Simplify figure layout.

05 Dec 2015 2.1

* Replace that awful automatically-generated title with the original title.

19 Mar 2016 2.1

* Update FEX blurb.

Contact us