View License

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

» Watch video

Highlights from
Bipolar Colormap

5.0 | 2 ratings Rate this file 18 Downloads (last 30 days) File Size: 274 KB File ID: #26026 Version: 1.1
image thumbnail

Bipolar Colormap


Ged Ridgway (view profile)


04 Dec 2009 (Updated )

Symmetric/diverging/bipolar cold-neutral-hot colormap

| Watch this File

File Information

A symmetric colourmap, with neutral central color, diverging either side to warm colors for positive values, and cold colours for negative ones. This is useful for data where the sign is important, e.g. expansion/contraction in fluid visualisation. This map should allow slightly better distinction of different values within the hot or cold partitions, compared to a map with only two colours (like red-grey-green

The neutral gray-level is user-definable, and the order of the light/dark colors either side automatically switches to match light or dark gray in the centre.

There is also an option to produce a colormap with a linear intensity/luminance variation when results are converted to grayscale. This requires the neutral gray-level to be 0.5.


Red Blue Colormap, Cm Rmap.M, Mrgb2gray, Tools For N If Ti And Analyze Image, Color Gray, and Real2rgb & Colormaps inspired this file.

This file inspired Cubehelix Colormaps: Beautiful, Distinct, Versatile!, Jetwhite(Colours), Color Brewer: Attractive And Distinctive Colormaps, and Squink(Colors,Gamma).

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements The colormap itself, bipolar, has no requirements, but colormap_investigation requires the Optimization Toolbox and real2rgb (ID 23342). Symmetric color limits are assumed, e.g. mx = max(abs(data)); set(gca, 'CLim', [-mx mx])
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
15 Jan 2014 ZZL Zhang

10 Mar 2010 Jody Klymak

Jody Klymak (view profile)

I'd also take a look at:

Comment only
08 Dec 2009 Ged Ridgway

Ged Ridgway (view profile)

Dear Oliver, thank you very much for your feedback.

Regarding the flipping, bipolar takes an optional second argument which specifies the gray-level value of the neutral color, and the ends are actually automatically flipped around if you specify a whiter shade of pale gray. E.g. if you specify 1, you get blue-cyan-white-yellow-red. Personally, I don't think this looks as nice, but that is of course subjective.

Regarding your other colormaps, I'm afraid I personally find the same perceptual issue with "bright" (purple bands above and below the pure blue) and with "pastel" (to a small extent but in several places).

I really like your thermal and temp colormaps, however, I am particularly keen on having a neutral mid-gray in the centre of the map (which was the reason I focused on hicontrast), rather than white (as in temp) or red (as in thermal).

I will play around with modifying CMRmap, thermal and temp, to see if I can find something I am really happy with... If you have any further suggestions, they would be much appreciated, thanks!

Comment only
08 Dec 2009 Oliver Woodford

Ged, real2rgb (id 23342) only linearizes a colormap's absolute gradient in luminance per color entry - they need to be monotonic to start with if you want monotonic output. It has several other monotonic colormaps (which can be linearized) other than hicontrast. Perhaps you'll find one you like.

My thoughts on this colormap are that it could look better with the two ends flipped so that they converge on white instead of dark gray. Have you tried it?

Comment only
07 Dec 2009 Ged Ridgway

Ged Ridgway (view profile)

Dear "us", thank you for your suggestion! I'll make your modification in a future update.

Comment only
07 Dec 2009 Ged Ridgway

Ged Ridgway (view profile)

Dear Sjoerd, thank you very much for drawing my attention to Carey Rappaport's CMRmap. It turns out that my colormap is not currently suitable for conversion to grayscale.

To some extent, it's actually rather difficult to get good visualisation of bipolar/signed data in grayscale anyway, but it would be nice to have a map that degraded more gracefully. I tried to find a bit more about the theory, but have so far failed. E.g. this site is otherwise very helpful,
but says "Differences in lightness should be preserved with sequential schemes" while "diverging schemes cannot be photocopied successfully." In other words, Dr Brewer doesn't attempt to make bipolar schemes with nice grayscale equivalents.

I found ID 23342 from a comment on CMRmap, and have just tried it out. Unfortunately, its conversion of my colormap to a linear-gray version doesn't seem to work well; the result is non-monotonic in gray-level (at least when converted from a saved PNG using the Gimp) and additionally translates the neutral gray away from the origin. ID 23342 also has a colormap called hicontrast, with linear grayscale, but I don't really like this, as it seems perceptually non-monotonic in color to me, e.g. either side of cyan you can see a pair of pale green colors, which are (by construction) separated in gray-level, but not really in hue, similarly either side of red is a pair of similar magenta hues.

I will try to look into this in more detail and provide an alternative map (necessarily without the user-definable neautral gray-level, as this will have to be at or very near to 0.5) that degrades better to grayscale in a future update... Thanks again for the heads-up!

Comment only
07 Dec 2009 Hex

Hex (view profile)

Have a look at the CMR map
How does your colormap perform in grayscale? Is it monotonically increasing as well?

Comment only
05 Dec 2009 us

us (view profile)

very nice colormap engine including good help and comments...

one of the (minor) short-comings:
it unnecessarily opens a figure (which is tediously true for ML's COLORMAP as well) if called without an open figure...
the following code prevents this from happening and could be inserted easily

if ~exist('m','var') || isempty(m)
if isempty(get(0,'currentfigure'))

just a thought

11 Dec 2009 1.1

This release responds to feedback, and includes a simple attempt at modifying some colormaps to yield a visually-pleasing colormap that degrades gracefully to linear luminance in grayscale.

Contact us