SkillAgentSearch skills...

Cmap

Perceptually uniform colormaps for MATLAB, compiled from multiple sources.

Install / Use

/learn @tsipkens/Cmap
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Perceptually uniform colormaps for MATLAB

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.

Colormap sources

Sources of these colormaps include:

matplotlib

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.

cmocean

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.

colorbrewer

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.

cmasher

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.

turbo

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.

seaborn

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.

scientific

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

custom

A set of custom colormaps specific to this package. The custom colormaps are only approximately perceptually uniform.

Other resources

A catalogue of colormaps for Julia can be found here: Catalogue of ColorSchemes.

Sweep through colormap

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):

<img src="docs/cmap_sweep.jpg" width="350px">

Catalogue

Sequential colormaps

Sequential colormaps have a monotonic change in perceived brightness. Colormaps consistently proceed from the darkest to the lightest colour.

matplotlib

<img src="docs/cividis.jpg" width="74%" height="25"> cividis

<img src="docs/inferno.jpg" width="74%" height="25"> inferno

<img src="docs/magma.jpg" width="74%" height="25"> magma

<img src="docs/plasma.jpg" width="74%" height="25"> plasma

<img src="docs/viridis.jpg" width="74%" height="25"> viridis

cmocean

<img src="docs/deep.jpg" width="74%" height="25"> deep

<img src="docs/dense.jpg" width="74%" height="25"> dense

<img src="docs/haline.jpg" width="74%" height="25"> haline

<img src="docs/oxy.jpg" width="74%" height="25"> oxy

<img src="docs/ice.jpg" width="74%" height="25"> ice

<img src="docs/matter.jpg" width="74%" height="25"> matter

<img src="docs/speed.jpg" width="74%" height="25"> speed

<img src="docs/tempo.jpg" width="74%" height="25"> tempo

<img src="docs/thermal.jpg" width="74%" height="25"> thermal

colorbrewer

<img src="docs/blues.jpg" width="74%" height="25"> blues

<img src="docs/BuPu.jpg" width="74%" height="25"> bupu

<img src="docs/GnBu.jpg" width="74%" height="25"> gnbu

<img src="docs/greens.jpg" width="74%" height="25"> greens

<img src="docs/pugnbu.jpg" width="74%" height="25"> pugnbu

<img src="docs/PuRd.jpg" width="74%" height="25"> purd

<img src="docs/purples.jpg" width="74%" height="25"> purples

<img src="docs/RdPu.jpg" width="74%" height="25"> rdpu

<img src="docs/reds.jpg" width="74%" height="25"> reds

<img src="docs/YlGnBu.jpg" width="74%" height="25"> ylgnbu

cmasher

<img src="docs/eclipse.jpg" width="74%" height="25"> eclipse

<img src="docs/ember.jpg" width="74%" height="25"> ember

<img src="docs/lavender.jpg" width="74%" height="25"> lavender

<img src="docs/nuclear.jpg" width="74%" height="25"> nuclear

<img src="docs/ocean.jpg" width="74%" height="25"> ocean

<img src="docs/rainforest.jpg" width="74%" height="25"> rainforest

seaborn

<img src="docs/crest.jpg" width="74%" height="25"> crest

<img src="docs/flare.jpg" width="74%" height="25"> flare

<img src="docs/mako.jpg" width="74%" height="25"> mako

<img src="docs/rocket.jpg" width="74%" height="25"> rocket

scientific

<img src="docs/acton.jpg" width="74%" height="25"> acton

<img src="docs/buda.jpg" width="74%" height="25"> buda

<img src="docs/devon.jpg" width="74%" height="25"> devon

<img src="docs/hawaii.jpg" width="74%" height="25"> hawaii

<img src="docs/imola.jpg" width="74%" height="25"> imola

<img src="docs/lajolla.jpg" width="74%" height="25"> lajolla

<img src="docs/oslo.jpg" width="74%" height="25"> oslo

<img src="docs/tokyo.jpg" width="74%" height="25"> tokyo

custom

<img src="docs/fblue.jpg" width="74%" height="25"> fblue

<img src="docs/fgreen.jpg" width="74%" height="25"> fgreen

<img src="docs/fred.jpg" width="74%" height="25"> fred

<img src="docs/fpurple.jpg" width="74%" height="25"> fpurple

<img src="docs/internet.jpg" width="74%" height="25"> internet

<img src="docs/fmviz.jpg" width="74%" height="25"> fmviz

Divergent colormaps

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.

cmocean

<img src="docs/balanced.jpg" width="74%" height="25"> balanced

<img src="docs/curl.jpg" width="74%" height="25"> curl

<img src="docs/delta.jpg" width="74%" height="25"> delta

colorbrewer

<img src="docs/brbg.jpg" width="74%" height="25"> brbg

<img src="docs/RdBu.jpg" width="74%" height="25"> rdbu

<img src="docs/RdYlGn.jpg" width="74%" height="25"> rdylgn

<img src="docs/PiYG.jpg" width="74%" height="25"> piyg

<img src="docs/PrGn.jpg" width="74%" height="25"> prgn

<img src="docs/PuOr.jpg" width="74%" height="25"> puor

<img src="docs/spectral.jpg" width="74%" height="25"> spectral

scientific

<img src="docs/cork.jpg" width="74%" height="25"> cork

<img src="docs/roma.jpg" width="74%" height="25"> roma

<img src="docs/vik.jpg" width="74%" height="25"> vik

custom

<img src="docs/weather.jpg" width="74%" height="25"> weather

turbo

<img src="docs/t

Related Skills

View on GitHub
GitHub Stars60
CategoryDevelopment
Updated1mo ago
Forks18

Languages

MATLAB

Security Score

85/100

Audited on Feb 22, 2026

No findings