Skip to content

GUI to facilitate defining perceptually linear colormaps in CIELab space

License

Notifications You must be signed in to change notification settings

maxalbert/colormap-selector

Repository files navigation

Quick start

  • Make sure that you have all dependencies installed (see below).

  • To start the GUI, run:

    python colormap_selector.py

  • Right-click into the two cross section plots on the left to change the start/end color of the colormap.

  • Use the sliders to select a different value of L (= lightness) for each cross section.

  • To quit, press the Esc key or close the main GUI window.

Whenever the colormap changes the 3D view on the right shows a linear interpolation of the start/end colors in CIELab color space. Moreover, the sample scatterplot (displayed in the separate window) is adjusted to use the new colormap.

Dependencies

Currently the following dependencies are needed.

  • Vispy (recent development version > 0.3.0)
  • Matplotlib
  • PyQt

Background Info

This is a GUI to facilitate the design of colormaps with "good" properties. It originated from a discussion discussion on the matplotlib mailing list about designing a new default colormap.

One of the major problems with many existing colormaps (including the infamous and harmful rainbow/jet colormaps), is that they are not perceptionally linear. This means that equal changes in the values of the displayed data do not correspond to color changes that are perceived as equal by humans, which is particularly harmful for scientific applications. For details see the references below.

The most commonly used RGB color space is not well suited for colormap design. Instead, there are other color spaces which are specifically designed to be perceptually linear. One example is the CIELab color space which represents each color using three the parameters L (= lightness), a (= red/green component) and b (= yellow/blue component).

This GUI helps defining perceptually linear colormaps. It consists of one main window which on the left displays two cross sections through CIELab space. Each of these corresponds to all those colors with a fixed value of L (lightness) that are representable in RGB space. The L-value for each cross section can be changed using the slider underneath.

The start/end color of the colormap can be selected by right-clicking inside the cross sections. The two selected colors are then interpolated linearly and this defines the whole colormap. The 3D view on the right illustrates this linear interpolation.

In addition, a sample scatterplot is displayed in a separate window which is adjusted whenever the colormap changes.

References

A random (and highly incomplete) selection of articles on color, colormaps and scientific visualization:

Known Bugs

The currently selected color in each of the 2D plots on the left should be indicated by a white dot. Sometimes these color indicators are not visible because the dot is drawn underneath the cross section. This is due to a known bug in Vispy (see: https://groups.google.com/forum/#!topic/vispy/z8b-Wglo3j0)

About

GUI to facilitate defining perceptually linear colormaps in CIELab space

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages