Giter Site home page Giter Site logo

cmap's Introduction

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. The first 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 shares 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/mpl

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.

colorbrewer2

Colormaps by Cynthia Brewer and Mark Harrower. More information available at http://colorbrewer2.org/. Released under an Apache License.

cmasher

A collection of scientific colormaps for making accessible, informative and cmashing plots in Python. More information 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 colour maps

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.

Sweep through colormap (cmap_sweep)

A function is also included to sweep through colors 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

Sequential colormaps have a monotonic change in perceived brightness.

matplotlib/mpl

cividis cividis

inferno inferno

magma magma

plasma plasma

viridis viridis

cmocean

deep deep

dense dense

haline haline

ice ice

matter matter

speed speed

tempo tempo

thermal thermal

colorbrewer2

blues blues

BuPu bupu

GnBu gnbu

greens greens

PuGnBu pugnbu

PuRd purd

purples purples

RdPu rdpu

reds reds

YlGnBu ylgnbu

cmasher

eclipse eclipse

ember ember

lavender lavender

nuclear nuclear

ocean ocean

rainforest rainforest

seaborn

crest crest

flare flare

mako mako

rocket rocket

Scientific colour maps

acton acton

buda buda

devon devon

hawaii hawaii

imola imola

lajolla lajolla

oslo oslo

tokyo tokyo

custom

(only approximately perceptually uniform)

fblue fblue

fgreen fgreen

fred fred

fred internet


Divergent colormaps

Divergent colormaps have the brightest or darkest color in the middle, with a monotonic change in perceived brightness in either direction.

cmocean

balanced balanced (originally balance, name conflict in Matlab)

curl curl

delta delta

colorbrewer2

RdBu rdbu

RdYlGn rdylgn

PiYG piyg

PrGn prgn

PuOr puor

spectral spectral

Scientific colour maps

cork cork

roma roma

vik vik


Cyclic/rainbow colormaps

Scientific colour maps

bamo bamo

corko corko

romao romao

viko viko

Other

turbo turbo (dedicated source)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.