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 at grayscale conversion
Colormaps have been taken from https://bids.github.io/colormap/ , the discussion of the new default colromaps in python's matplotlib.
It should work for any Matlab release (both with the new and old graphics handles)
Colormaps created by: Stéfan van der Walt and Nathaniel Smith.
The colormaps have been published under a (CC0) Creative Commons License by the original authors. I do not own any copyright on them, this is a simple repackaging of the colormaps for MATLAB.
Ander Biguri (2020). Perceptually uniform colormaps (https://www.mathworks.com/matlabcentral/fileexchange/51986-perceptually-uniform-colormaps), MATLAB Central File Exchange. Retrieved .
Magma works well for spectrograms.
@Stephen Well, yes more or less. Back when I posted this the notice on top of the github.io page was not there, and I did not find any information about licenses, so there was not much I could do. My mistake was not following up on licenses.
@Ander: you were lucky that Viridis et al were released under the CC0 license :)
Addendum: it seems that the license files are in fact not distributed with MatPlotLib itself. I was just searching for Cynthia Brewer's license (a fairly distinctive name to search for) but the closest that I could locate was this statement: "for details, see the file LICENSE_COLORBREWER in the license directory of the matplotlib source distribution", e.g. which can be viewed on GitHub:
Interestingly other packages/libraries *do* include the full licenses with the distributed colormap code. I have no idea why MatPlotLib omits them.
You are correct, I did this a while ago and forgot about it, but its no excuse to keep the information wrong. I really appreciate bringing this up and I will update the license information and text in the FEX submission.
"However as they are inbuilt in python, they have no copyright..."
This statement is incorrect on two major points.
1. Python itself (the programming language) does not define any colormaps, inbuilt or otherwise. Nor, for that matter, does the Python language standard define anything related to plotting or GUIs.
2. Most of the colormaps distributed with MatPlotLib (which is NOT Python) are in fact covered by various types of OpenSource license. For example Cynthia Brewer's colormaps are licensed under an Apache v2 license, so it is NOT permitted to distribute them simply because they are included in MatPlotLIb: their required license requirements must also be met. You can find the relevant license information in the same file as the colormap data themselves (named "palletes.py" in the MatPlotLib module).
Colormaps Viridis, Magma, Plasma, and Inferno have been released under a Creative Commons (CC0) license, which makes it possible to distribute them without their original license (however their authors do request that "We would appreciate credit if you use or redistribute these colormaps..."). However this ability to redistribute those specific colormaps without any specific license is solely due to the type of license that their creators originally released them under, and has nothing to do with them being distributed as part of MatPlotLib (or being related to Python).
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?
Great. Thanks for implementing this.
Thank you. This is gold dust.
Very important! Should be default in MatLab!
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 https://bids.github.io/colormap/ 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 (https://au.mathworks.com/matlabcentral/fileexchange/17555-light-bartlein-color-maps). But thanks for giving me some more useful options.
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
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.
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.
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));
Inspired: AlexHenderson/cividis, PyColormap4Matlab, multiTrace3D, CubeHelix Colormap Generator: Beautiful and Versatile!, ColorBrewer: Attractive and Distinctive Colormaps, MatPlotLib Perceptually Uniform Colormaps
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!