I have not done much work with, or written here on the blog about colormaps and perception in quite some time.
Last spring, however, I decided to build a web-based app to show the effects of using a bad colormaps. This stemmed from two needs: first, to further my understanding of Panel, after working through the awesome tutorial by James Bednar, Panel: Dashboards (at PyData Austin 2019); and second, to enable people to explore interactively the effects of bad colormaps on their perception, and consequently the ability to on interpret faults on a 3D seismic horizon.
I introduced the app at the Transform 2020 virtual subsurface conference, organized by Software Underground last June. Please watch the recording of my lightning talk as it explains in detail the machinery behind it.
I am writing this post in part to discuss some changes to the app. Here’s how it looks right now:
The most notable change is the switch from one drop-down selector to two-drop-down selectors, in order to support both the Matplotlib collection and the Colorcet collection of colormaps. Additionally, the app has since been featured in the resource list on the Awesome Panel site, an achievement I am really proud of.
You can try the app yourself by either running the notebook interactively with Binder, by clicking on the button below:
or, by copying and pasting this address into your browser:
Let’s look at a couple of examples of insights I gained from using the app. For those that jumped straight to this example, the top row shows:
- the horizon, plotted using the benchmark grayscale colormap, on the left
- the horizon intensity, derived using
skimage.color.rgb2gray, in the middle
- the Sobel edges detected on the intensity, on the right
and the bottom row, shows:
- the horizon, plotted using the Matplotlib
gist_rainbowcolormap, on the left
- the intensity of the colormapped, in the middle. This is possible thanks to a function that makes a figure (but does not display it), plots the horizon with the specified colormap, then saves plot in the canvas to an RGB numpy array
- the Sobel edges detected on the colormapped intensity, on the right
I think the effects of this colormaps are already apparent when comparing the bottom left plot to the top left plot. However, simulating perception can be quite revealing for those that have not considered these effects before. The intensity in the bottom middle plot is very washed out in the areas corresponding to green color in the bottom left, and as a result, many of the faults are not visible any more, or only with much difficulty, which is demonstrated by the Sobel edges in the bottom right.
And if you are not quite convinced yet, I have created these hill-shaded maps, using Matt Hall”s delightful function from this notebook (and check his blog post):
Below is another example, using the Colocrcet
cet_rainbow which is is one of Peter Kovesi’s perceptually uniform colormaps. I use many of Peter’s colormaps, but never used this one, because I use my own perceptual rainbow, which does not have a fully saturated yellow, or a fully saturated red. I think the app demonstrate, that even though they are more subtle , this rainbow still is introducing some artifacts. The yellow colour creates narrow flat bands, visible in the intensity and Sobel plots, and indicated by yellow arrows; the red colour is also bad as usual, causing an artificial decrease in intensity(magenta arrows).
The Blog is very interesting, Awesome blog !
Thanks for sharing the information !
Thanks for the feedback Brij