NOTE: All rights to the original authors. For licensing see information for individual sources in Colormap sources. Custom colormaps new to this work are released under a MIT License.
This repository contains files for colormaps, mostly compiled from multiple, external sources (see dedicated section below), with some custom colormaps that are specific to this package. After making a copy of the folder locally, the next step in their use is to add the parent folder to the sample project, e.g.,
addpath cmap; % add cmap folder to the MATLAB path
Then colormaps can be loaded by calling the functions that share their name. For example, you can get the color data for the viridis colormap using,
cm = viridis; % return colormap data to cm
or apply it to a plot using
colormap(viridis); % apply viridis to a plot
Optional arguments to these functions allow for changing the number of colors in the colormap. For example, getting the 100-color equivalent of viridis,
viridis(100); % interpolate to 100 colors in RGB space
By default, this will use linear interpolation in RGB space. Alternatively, interpolation can be done in HSV space by appending 'hsv'
as an additional argument:
viridis(100, 'hsv'); % interpolate to 100 colors in HSV space
Note that the deep, dense, matter, and tempo colormaps are reversed from their original order, such that the darker color is always first. The colormaps, and swages indicating their color progression, are included at the end of this README.
Sources of these colormaps include:
Colormaps designed by Stéfan van der Walt (https://github.com/stefanv) and Nathaniel Smith (https://github.com/njsmith). More information is available at https://bids.github.io/colormap/. Released under a CCO license. You can learn more about the science behind the creation of these kinds of colormaps by watching their presentation of viridis: https://youtu.be/xAoljeRJ3lU. The cividis colormap is a variant of ‘viridis’ developed by Jamie R. Nuñez, Christopher R. Anderton, and Ryan S. Renslow.
More information is available at https://matplotlib.org/cmocean/. Released under a MIT license. The colormaps are associated with: Kristen M. Thyng, Chad A. Greene, Robert D. Hetland, Heather M. Zimmerle, and Steven F. DiMarco. True colors of oceanography: Guidelines for effective and accurate colormap selection. Oceanography, September 2016. http://dx.doi.org/10.5670/oceanog.2016.66.
Colormaps by Cynthia Brewer and Mark Harrower. More information available at http://colorbrewer2.org/. Released under an Apache License. For diverging colormaps, the order of colors was made consistent with the colormap names. For sequential colormaps, orders were adjusted such that darkest colors appear first. Original colormaps can be restored by using MATLAB's built-in flipud(...)
function of the altered colormaps.
A collection of scientific colormaps for making accessible, informative and cmashing plots in Python. More information is available at https://github.com/1313e/CMasher and https://cmasher.readthedocs.io/. Released under a BSD 3-Clause License.
A. Mikhailov. Turbo, An Improved Rainbow Colormap for Visualization. More information is available at https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html. Released under an Apache License.
Originally for Python by Michael Waskom. For supporting discussion see README at https://github.com/mwaskom/seaborn and https://seaborn.pydata.org/tutorial/color_palettes.html. Released under a BSD 3-Clause License.
A set of scientific colour maps by Fabio Crameri. Released under an MIT License. Citable at:
Crameri, F. (2018). Scientific colour maps. Zenodo. http://doi.org/10.5281/zenodo.1243862
A set of custom colormaps specific to this package. The custom colormaps are only approximately perceptually uniform.
A catalogue of colormaps for Julia can be found here: Catalogue of ColorSchemes.
The cmap_sweep(n, cm)
function is also included to sweep through colours in a standard MATLAB plot. To demonstrate we first generate some synthetic data with a set number of lines:
n_lines = 40; % number of lines to plot
addpath supplement; % add supplemental functions / scripts
% generate test data
y = test_data(round(n_lines*2.5), 300);
y = y(:, 1:n_lines);
Then, one can sweep through the viridis colormap using:
figure(1);
cmap_sweep(n_lines, inferno); % set colororder for plot
plot(y); % plot data
A sample plot generated using this procedure (Sipkens et al., Submitted):
Sequential colormaps have a monotonic change in perceived brightness. Colormaps consistently proceed from the darkest to the lightest colour.
Divergent colormaps have the brightest or darkest color in the middle, with a monotonic change in perceived brightness in either direction. Note that the colorbrewer colormaps are in the order of the characters (for example, RdBu starts with red and goes to blue). The balance colormap from cmocean has been renamed to balanced, to avoid a name conflict with a native MATLAB function.
These colormaps start and end with the same colour.