These colormaps were developed by Kristen Thyng using viscm. They are perceptually uniform, as color should be when it serves as a numeric axis.
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
Nice set of functions for extending the default set of colormaps.
Thanks Phelype! I've updated the function as per your suggestion.
I also stumbled upon the problem with the using the number of levels and the 'pivot' argument.
This is a bug in the argument parser. I propose the following fix:
Change the line (150) that says:
tmp = any([strncmpi(varargin,'pivot',3) strncmpi(varargin,'zero',3)]);
tmp = strncmpi(varargin,'pivot',3) | strncmpi(varargin,'zero',3);
It works for me after this change.
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
Modified input parser, following a suggestion by Phelype Oleinik. Also, now, if no outputs are specified it sets the colormap of the current axes via colormap(gca,cmap) whereas previously it was simply colormap(cmap).
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: Oceanographic Data Visualized with MATLAB, CMRmap.m, Color Palette Tables (.cpt) for Matlab, Modified CMRmap, CubeHelix Colormap Generator: Beautiful and Versatile!, ColorBrewer: Attractive and Distinctive Colormaps, Mixing (MX) Oceanographic Toolbox for EM-APEX float data, jLab: A Matlab toolbox for data analysis, Argo Toolbox, crameri perceptually uniform scientific colormaps, Colorspace Transformations, Cyclic color map
Inspired: xcorr3, EOF, crameri perceptually uniform scientific colormaps, Cyclic color map, anomaly, How to estimate subglacial water routes, Intuitive RGB color values from XKCD, MatPlotLib 2.0 Colormaps: Perceptually Uniform and Beautiful, Daily Antarctic sea ice concentration, Arctic Sea Ice, CirHeatmap, Antarctic Mapping Tools
Create scripts with code, output, and formatted text in a single executable document.