Kardo Paska
Kardo Paska

Reputation: 584

More perceptually uniform colormaps?

I am an advocate of using perceptually uniform colormaps when plotting scientific data as grayscale images and applying false colorings. I don't know who invented these, but these colormaps are fantastic and I would not use anything else.

Anyways to be honest, I've gotten a bit bored of the 5 colormaps (viridis, plasma, inferno, magma, cividis) which have been implemented in many popular graphing softwares (R-ggplot, python-matplotlib, matlab, JMP, etc.). I'm sure some of you also feel the same monotony...

So in addition to those 5 colormaps, what are some other colormaps which are perceptually uniform?

BONUS: Is there some algorithm to derive colormaps with perceptually uniform qualities (maybe not since color perception has a psychological aspect)? but if so, what is it?

Some examples & refs: https://matplotlib.org/tutorials/colors/colormaps.html https://matplotlib.org/tutorials/colors/colormaps.html

https://www.youtube.com/watch?v=xAoljeRJ3lU

Upvotes: 16

Views: 9756

Answers (3)

Kel Solaar
Kel Solaar

Reputation: 4090

If you follow this page: http://bids.github.io/colormap/, you will find all the details required to produce Viridis, Magma, Inferno and Plasma. All the details are too long to enumerate as an answer but using the aforementioned page and viscm, you can regenerate them and some more interactively.

Alternatively, and using Colour:

import colour
import numpy as np

CAM16UCS = colour.convert(['#ff0000', '#00ff00'], 'Hexadecimal', 'CAM16UCS')
gradient = colour.algebra.lerp(
    np.linspace(0, 1, 20)[..., np.newaxis],
    CAM16UCS[0][np.newaxis],
    CAM16UCS[1][np.newaxis],
)
RGB = colour.convert(gradient, 'CAM16UCS', 'Output-Referred RGB')

colour.plotting.plot_multi_colour_swatches(
    [colour.plotting.ColourSwatch(RGB=np.clip(x, 0, 1)) for x in RGB])

print(colour.convert(RGB, 'Output-Referred RGB', 'Hexadecimal'))

['#fe0000' '#fb3209' '#f74811' '#f35918' '#ef671e' '#ea7423' '#e67f28'
 '#e18a2c' '#dc9430' '#d79e34' '#d1a738' '#cbb03b' '#c4b93d' '#bcc23e'
 '#b2cc3d' '#a6d53a' '#97df36' '#82e92e' '#62f321' '#00ff00']

PUG

Note that the two boundary colours are given as hexadecimal values but you could obviously choose any relevant colourspace. Likewise, CAM16 could be swapped for JzAzBz or alike.

You can try that online with this Google Colab notebook.

Upvotes: 10

Mark Loyman
Mark Loyman

Reputation: 2180

For deriving colormaps with perceptually uniform qualities, please refer to this answer.

The following python packages offer (perceptually uniform) colormaps:

Upvotes: 1

1313e
1313e

Reputation: 1232

Bit late I suppose, but my CMasher package provides a large collection (I think it is 42 at the time of writing) of scientific colormaps that are all perceptually uniform sequential. Below is an overview of all colormaps that are currently available in CMasher at the time of writing. CMasher colormap overview

In the online documentation, I describe every single colormap individually; discuss the main ways to improve colormap usage and much more. It also provides a collection of utility functions that can be used to manipulate colormaps in various ways.

Upvotes: 14

Related Questions