A Better Default Colormap for Matplotlib | SciPy 2015 | Nathaniel Smith and Stéfan van der Walt

178K views · 11 years ago · talk · intermediate · evergreen

Nathaniel Smith and Stéfan van der Walt present the thinking behind Matplotlib's new default colormap, viridis, at SciPy 2015. They show why the old jet rainbow map distorts data, explain perceptual uniformity and color spaces, and cover how the new map holds up under color blindness and in greyscale.

HN points to it as the clearest account of why rainbow colormaps mislead and how to build perceptually uniform, accessible ones.

“actually spends a good ten minutes on explaining colour theory, and makes it look very simple in the process”

24 comments from Hacker News

c
@carpdiem2026 · in “Show HN: Ember – Redshift safe color palettes”
That's a... surprisingly deep question. I'm actually a physicist by background first, so I got my start doing waaayyy too many calculations with blackbody and emissions spectra. Then, back in 2010, when I was just getting into startups, I spent two weeks straight at Powell's in Portland reading through their graphic design section. After that, I never got very far away from light or perception... AR/VR -> graphics -> silicon photonics -> physical AI (now). I'm still very much learning, but if you like this stuff and want to learn more yourself there's a couple sources I can recommend: - Interaction of Color, by Josef Albers. Amazing book, but you really want to get a physical copy. - I really like this talk from SciPy 2015 to get a sense of how people work with and talk about color maps in practice: ▶ this video - This is a really, really thorough (and beautifully illustrated) article on what color spaces are: link - And last, I wrote a very technical blog post a few years back, if you want to see some math on a bunch of this: link
RecommendsView on HN
q
@qwertox2025 · in “Issues with color spaces and perceptual brightness”
If this submission has put you into a mindset of wanting to know more about colormaps, here's a good video about how Matplotlib ended up having `vividris` as its default colormap: A Better Default Colormap for Matplotlib | SciPy 2015 | Nathaniel Smith and Stéfan van der Walt ▶ this video
RecommendsView on HN
m
@maxnoe2024 · in “Show HN: I made a new sensor out of 3D printer filament for my PhD”
Very Cool! Since you mentioned the visualization part, let me comment on my pet pieve: The rainbow / jet color map should not be used for anything. It distorts your data and is not accessible for people with color vision deficiencies. If you want to know more, have a look here: link and this talk here: ▶ this video
RecommendsView on HN
q
@quietbritishjim2023 · in “Why Japan has blue traffic lights instead of green”
Depending on what exactly your figures were/are, you might benefit from the viridis colour map, available in matplotlib and R (and probably in many other places). It's colourful, so those without colour blindness get a richer display than if you used greyscale, and the colours chosen aren't too affected by most common forms of colour blindness. But for those that really can't see the colours, even if you literally just convert to monochrome, it still works. It also looks nice :-) Here's a talk by the creators: ▶ this video Here's a little article about it (with some R specifics): link
RecommendsView on HN
C
@CorrectHorseBat2021 · in “Rainbow Color Map Still Considered Harmful (2007) [pdf]”
You're increasing the discriminability at the cost of high _local_ distortion, I don't see how that is a good tradeoff. As a comparison, what would you rather have: a non-distorted plot or a plot that is on average about three times as big, but it's heavily distorted. At some places it's smaller than the original and on other places it's 5 times bigger. Would you really choose the bigger figure? That is what jet is. Look at this plot ▶ this video (watch the whole video if you have the time), ideally you want the derivatives (the 2 plots on the left top) to be constant so not to distort your data. Jet is all over the place while viridis is basically constant (not shown in the slides, but the derivative stays all the way around 120).
RecommendsView on HN
m
@maliker2021 · in “Which color scale to use when visualizing data”
There’s a great talk [1] on how SciPy chose their new default colormap viridis to replace the rainbow colored former default “jet”. Turns out that there have been good studies on how the wrong colormap can lead to bad decisions in medicine, and designing a replacement took a lot of careful work. [1] ▶ this video
RecommendsView on HN
s
@steerablesafe2021 · in “Ditherpunk: The article I wish I had about monochrome image dithering”
> I don't get what you mean, linearity (dL'star') being defined wrt perceptual uniformity, isn't CIELAB 76 linear by definition (to an approximation) ?? And color arithmetic pretty much by definition implies dealing with distances and angles in a perceptually uniform color space, doesn't it ?? No. Linearity is about physical light intensities relating to perceived color. Imagine having two light sources on the same spot that you can turn on or off separately. If you turn the first one on you perceive a certain color, if you turn the other on you perceive an other color and if you turn both on you perceive a third one. It turns out the perceivable colors (under normal viewing conditions) are representable in a three dimensional vector-space (for most people) so that the first two colors add up to the third color for every possible two light sources. Such a linear colorspace is XYZ for example [1]. This has nothing to do with perceptual uniformity. Perceptual uniformity is about the capability of distinguishing near colors. This defines a distance between colors, and there are three dimensional colorspace representations where the Euclidean distance approximate this perceptual distance well. cieLAB is such a colorspace, but AFAIK there are better state of the art colorspaces for the same purpose. I'm not very well versed in this, I learned from them from this video [2]. [1] link [2] ▶ this video edit: gimp 2.10 now defaults to use a linear colorspace (not perceptually uniform!) for most if not all of its functionalities. This affects alpha-blending layers, the paintbrush, resizing, blur, and pretty much everything that involves adding/averaging colors. There is still a "legacy" option on these tools to turn back to the probably wrong sRGB methods, probably for compatibility with old gimp files. There is a dramatic difference when you use a soft green brush on a red background for example, it's worth to try out.
RecommendsView on HN
s
@s1mon2020 · in “The misuse of colour in science communication”
If you haven't already watched this, here's the SciPy2015 presentation on the development of viridis. It helps to explain the importance of color maps and how human visual color perception works. ▶ this video
RecommendsView on HN
a
@azepoi2020 · in “How to Avoid Equidistant HSV Colors (2011)”
I'm impressed by the other mentioned picker, for HCL this time link This tool is also useful link I have to mention this fantastic presentation on colormaps ▶ this video (A Better Default Colormap for Matplotlib, SciPy 2015, Nathaniel Smith and Stéfan van der Walt). It is about perceptually uniform colormaps. link
RecommendsView on HN
m
@maxnoe2020 · in “Brown: color is weird [video]”
Also watch this please if you ever do plots using colormaps: ▶ this video About the perceptual uniform, colorblind friendly colormaps in matplotlib since 1.5. Now also adapted by most other plotting tools.
RecommendsView on HN
n
@neilpanchal2019 · in “Designing Accessible Color Systems”
I built similar perceptually uniform color library: link The sad part is that we have all these colors available in the physical world but representing in sRGB (or even Adobe RGB or DCI P3) space takes away all the fun. We have a narrow space to work within and it poses limits to what you can do. Vast majority of monitors in the world are barely capable of representing sRGB space, and even if they are, calibration is another issue. You can employ all kinds of science in representing proper colors but if the end user's calibration is not good, all bets are off. Colors are a problem for interface design (and accessibility), it becomes a real challenge when dealing with quantitative data and build perceptually uniform colormaps with accessibility considerations, here is an amazing presentation of Matplotlib's new colormaps: ▶ this video
RecommendsView on HN
s
@spectramax2019 · in “Turbo, an Improved Rainbow Colormap for Visualization”
> Today we are happy to introduce Turbo, a new colormap that has the desirable properties of Jet while also addressing some of its shortcomings, such as false detail, banding and color blindness ambiguity. What are the desirable properties of Jet? Why not use Viridis or Magma or any of the recent linear colormaps from matplotlib 2.0? These shortcomings were the exact reason why Viridis was created as exemplified in this brilliant talk: ▶ this video I don't understand the point of Turbo. > Turbo mimics the lightness profile of Jet, going from low to high back down to low, without banding. As such, its lightness slope is generally double that of Viridis, allowing subtle changes to be more easily seen. This is a valuable feature, since it greatly enhances detail when color can be used to disambiguate the low and high ends. Why would anyone want low-to-high-to-low colormap? > Viridis is a linear color map that is generally recommended when false color is needed because it is pleasant to the eye and it fixes most issues with Jet. Inferno has the same linear properties of Viridis, but is higher contrast, making it better for picking out detail. However, some feel that it can be harsh on the eyes. While this isn’t a concern for publishing, it does affect people’s choice when they must spend extended periods examining visualizations. Personal taste vs scientific accuracy - I will take the latter unless we are doing plots for marketing materials. In my view this is not substantiated reason for going off and creating a more pleasant version of Jet; Turbo is still inaccurate and deceiving. This is a deplorable attempt at creating a new colormap where the problem statement isn't clear in the first place.
RecommendsView on HN