File Exchange

image thumbnail

cmocean perceptually-uniform colormaps

version 1.4 (545 KB) by

Perceptually-uniform colormaps inspired by oceanography



View License

These colormaps were developed by Kristen Thyng using viscm. For more information about the colormaps visit
New: I'm excited to announce our peer-reviewed paper on cmocean has just come out in the journal Oceanography. If these colormaps are useful for you, please consider citing our paper:
Thyng, K.M., C.A. Greene, R.D. Hetland, H.M. Zimmerle, and S.F. DiMarco. 2016. True colors of oceanography: Guidelines for effective and accurate colormap selection. Oceanography 29(3):9–13.

Comments and Ratings (17)

Fabian Grosse

Hi, first off - this is a really helpful and great looking set of colours!
I came across the same problem as Andrea these days, and worked on a solution which works satisfactorily for me. I am happy to share, just don't know how to do this best.


Andrea (view profile)

Is it possible to specify the number of levels AND a pivot value?
For example: cmocean('balance',12,'pivot',0)
I seem to cannot make it work. It does the same as cmocean('balance','pivot',0) ignoring the number of levels


Andrea (view profile)

Léa Olivier

E. Cheynet

E. Cheynet (view profile)

Geroge James

Thank you Chad. That definitely helps. Maybe one of those could be an optional argument?
And thank you for directing me to the colorspace package.

Chad Greene

Chad Greene (view profile)

Hi David,

Thanks for the feedback. I see what you're saying about the off-white values in the center of the colormaps. These colormaps are the ones described in the paper published in Oceanography, and I think the rationale for not quite going all the way to pure white was to keep the colormap from blending in with a white background. I'm a bit colorblind myself, so I don't feel qualified to tinker with the colormaps. If you'd like to tinker on your own, get Pascal Getreuer's wonderful colorspace transformation function and try this:

C = cmocean('delta');

% Convert the colorspace:
hsl = colorspace('rgb->hsl',C);

% The lightness is the third column:
L = hsl(:,3);

% Make the peak white by setting its lightness to 100%
% Shift the lightness up a little to lighten the entire colormap:
L2 = L + (1-max(L));

% Or stretch the lightness values if you prefer to keep the low ends:
L2 = L/max(L);

% Convert back to RGB:
C2 = colorspace('hsl->rgb',[ hsl(:,1:2) L2]);

plot(L,'b'); hold on;
ylabel 'lightness'

Thank you for creating these colormaps! They have been extremely useful.

I do have some comments about the divergent colormaps. The center value doesn't come out white. For the delta colormap it returns an ugly yellow tinge to the background. The curl colormap leaves a slight red, and balance leaves an even slighter red. I have tried to use the zero/pivot command and it has not made a difference.
The issue appears to lie in the autopivot section (the code block after line 212). There is no specification that an RGB value of [1 1 1] should be returned in the middle of the colormap. Can this please be added into the code? It will be a fantastic improvement so that the background will actually be white.

Chad Greene

Chad Greene (view profile)

Hi Ola,

As a lowly graduate student I certainly appreciate the citations, thanks. The cmocean colormaps are available in GMT-friendly cpt format here:

Ola Kalen

Sorry, my mistake, 0 -> blue just as you say.
OT: Will definitely cite Thyng et al in my next paper, hopefully out before summer. Any plans for a GIS package?

Chad Greene

Chad Greene (view profile)

Hi Ola,

Thanks for the kind words.

The "ice" colormap is designed to mimic the way sea ice looks in the ocean. Zero concentration of sea ice looks like a dark blackish blue, whereas 100% sea ice cover is nearly pure white.

If you prefer to flip the order of any colormap, the flipud command is one way to do it. A simpler way is to use the - sign when you call the colormap. For example,

cmocean -ice

Let me know if you think of other ways cmocean can be more user friendly or improved in any way.

Ola Kalen

Very good, thanks! To make it even better, maybe the "ice" colormap should be inverted in the package? It´s easy enough to use "flipud" to fix it, but maybe not for a beginner.

yi Wang

wish extend as python can be added

Thanks very much, seems the behavior of either imread or image changed; to get the correct image in release R2016b when doing cmocean with nargin==0, line 104 of cmocean should be




Documentation fix.


Added a new "negative" option for divergent colormaps.


The 'zero' option for diverging colormaps has been extended to a 'pivot' syntax, which allows setting a pivot point to any value, zero or otherwise.


Added a link to our Oceanography paper. Also added the feature to simply type "cmocean" to bring up a window showing colormap options.

MATLAB Release
MATLAB 8.0 (R2012b)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

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

» Watch video