These colormaps were developed by Kristen Thyng using viscm. For more information about the colormaps visit http://matplotlib.org/cmocean/.
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. http://dx.doi.org/10.5670/oceanog.2016.66
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.
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
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.
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;
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.
As a lowly graduate student I certainly appreciate the citations, thanks. The cmocean colormaps are available in GMT-friendly cpt format here: https://github.com/kthyng/cmocean-gmt
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?
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,
Let me know if you think of other ways cmocean can be more user friendly or improved in any way.
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.
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
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.
Inspired by: Cyclic color map, Colorspace Transformations, Oceanographic Data Visualized with MATLAB, CMRmap.m, Color Palette Tables (.cpt) for Matlab, Modified CMRmap, Cubehelix Colormaps: Beautiful, Distinct, Versatile!, ColorBrewer: Attractive and Distinctive Colormaps, Mixing (MX) Oceanographic Toolbox for EM-APEX float data, jLab: A Matlab toolbox for data analysis, Argo Toolbox
Inspired: How to estimate subglacial water routes, Cyclic color map, anomaly, EOF, xcorr3, MatPlotLib 2.0 Colormaps: Perceptually Uniform and Beautiful, Intuitive RGB color values from XKCD, Daily Antarctic sea ice concentration, Arctic Sea Ice, Antarctic Mapping Tools, CirHeatmap
Win cash prizes and have your live script featured on our websiteLearn more
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.