File Exchange

image thumbnail

Perceptually uniform colormaps

version (249 KB) by Ander Biguri
New Improved colormaps taken from python.


Updated 01 Aug 2016

View License

Perceptually uniform colormaps adds 4 new colormaps that are:
1) Perceptually uniform (Delta color is equal in all delta data)
2) Colorblind friendly
3) Good grayscale conversion
4) Look nice!
Colormaps have been taken from , the discussion of the new default colromaps in python's matplotlib.
Colormaps created by: Stéfan van der Walt and Nathaniel Smith
It should work for any Matlab release (both with the new and old graphics handles)

Comments and Ratings (31)


My hero!

Ander Biguri

Hi Murty,

I do not own the copyright of these colors, as the originals are from python (see link above). However as they are inbuilt in python, they have no copyright and you should be OK to use them freely.


Thanks a ton for these colormaps.
I am using magma for my article.
Are there any copyright requirements that need to be fulfilled or citations that need to be made in my article?

Guojin Feng

Great. Thanks for implementing this.

Luis Mendo


Thank you. This is gold dust.

Fabio C

Fabio C

Very important! Should be default in MatLab!

Ander Biguri

Hi Tim,

I am glad that this colormaps can actually help! I can nor argue with what you can see better, but these colormaps have other advantages rather than only being colorblind friendly. They are perceptually uniform, which is a key feature for the proper showing of scientific data (else colors may mislead the reader) and they print very nicely in grayscale.


Thanks for this implementation. I'm red-green colourblind and I struggle to find colour maps that give me confidence that I am seeing the same level of information as non-colourblind people. These are pretty good but in each one I still lose definition in some region. I have just compared with a non-colourblind person I share an office with. I see the regular colourmap and the 2 deuteranopia colourmaps below them as identical where he sees the 'complete deuteranopia' as quite different to the other 2 (so their colourblind simulation works well). On balance I get less loss of definition using the Light-Bartlein diverging blue-brown or blue-red colourmaps so I think I'll stick with them despite their poor black and white reproduction ( But thanks for giving me some more useful options.


Ander Biguri

Hi arnold,

Happy you liked them, indeed I also sometimes cut the "black" parts of the colormaps! The fake_parula is there for MATLAB version previous to 2014b, where parula does not exists.


thanks for these excellent colormaps.
I've been annoyed with matlabs jet option for years and then parula came and I started to think about colormaps. I compared yours to parula and they look good, I like it that hue doesn't change so much BUT, parula resolves more in the darker areas on a screen which, and this is a guess, not measured, is due to the fact that it is either a bit more nonlinear (steeper) there than viridis & Co or because the almost blackish-phase is more extended. I solved it for me by modifying the functions in the way that I cut off the darkest 15% and now I am able to see more detail in the shadows.

My favorite: inferno - with the darkest 15% cut off.

What is the 'fake_parula' for? Just fun? :P


Ander Biguri

Thank you for the feedback Israel and Tijs. The name of parula.m has been changed to avoid shadowing and the wrong colors when interpolating the colormaps have been fixed.

These colormaps are really great.

I found a bug due to linear interpolation in the magma colormap. magma(128) produces a green band for the 85th color output. This is because there is a discontinuity in hue, and the linear interp puts a value in the middle of the discontinuity.

Otherwise love them.

Hi. A name conflict arises because of the inclusion of parula.m in the package. Matlab already has a function named parula.m. This causes problems when generating a colorbar for example. Please consider renaming this file in your package.

E. Cheynet

Ander Biguri

Hi Bob DA. Glad you like them. I just updated the colormaps to accept an extra argument for the size of them. Thanks for the suggestion. However note that color interpolation should be done in HSV space, not in RGB, as it wont give the right results in RGB.

Bob DA

Beautiful colormaps! It would be nice if users could also specify the desired colormap size (as is possible with the Matlab defaults). A quick & dirty way to do that is to add to the end of each file (where 'm' is the desired size):

if nargin < 1
data2 = data;
data2 = zeros(m,3);
for i = 0:m-1
L = size(data,1);
data2(i+1,:) = interp1((0:L-1),data,i*(L-1)/(m-1));


Fixed unnecessary preallocation

Updated error when interpolating in HSV from 1-0 and changed the name of parula to avoid shadowing.

Colormaps have a name now: Magma, Inferno, Plasma and Viridis.

Improved speed of interpolation and modified demo2 for fanciness.

Updated bug in demos

py_D_cmap changed name to its official name: viridis

added info and updated colormaps and demo to accept an argument for the size of the colormap

Now Colormaps accept an optional argument for the size of them, as Matlab colromaps do.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags