Color vision deficiency (CVD) affects more than 4% of the population and leads to a different visual perception of colors. Though this has been known for decades, colormaps with many colors across the visual spectra are often used to represent data, leading to the potential for misinterpretation or difficulty with interpretation by someone with this deficiency. Until the creation of the module presented here, there were no colormaps mathematically optimized for CVD using modern color appearance models. While there have been some attempts to make aesthetically pleasing or subjectively tolerable colormaps for those with CVD, our goal was to make optimized colormaps for the most accurate perception of scientific data by as many viewers as possible. We developed a Python module, cmaputil, to create CVD-optimized colormaps, which imports colormaps and modifies them to be perceptually uniform in CVD-safe colorspace while linearizing and maximizing the brightness range. The module is made available to the science community to enable others to easily create their own CVD-optimized colormaps. Here, we present an example CVD-optimized colormap created with this module that is optimized for viewing by those without a CVD as well as those with red-green colorblindness. This colormap, cividis, enables nearly-identical visual-data interpretation to both groups, is perceptually uniform in hue and brightness, and increases in brightness linearly.

Funding: This research was partially supported by the Genomic Science Program (GSP), Office of Biological and Environmental Research (OBER), the U.S. Department of Energy (DOE), and is a contribution of the Pacific Northwest National Laboratory (PNNL) Foundational Scientific Focus Area (SFA). A portion of this research was performed in the W. R. Wiley Environmental Molecular Sciences Laboratory (EMSL), a national scientific user facility sponsored by the Office of Biological and Environmental Research (BER) and located at PNNL. PNNL is a multi-program national laboratory operated by Battelle for the DOE under Contract DE-AC05-76RLO 1830.The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Data Availability: Most of the relevant data are within the paper and its Supporting Information files. The scripts referred to in this paper can be found at https://github.com/pnnl/cmaputil or can be downloaded using PyPI (pip install cmaputil). Any other data or scripts (e.g. figure generation scripts and Adobe Illustrator files) are available from the authors, whom may be contacted at ryan.renslow@pnnl.gov . The data currently publicly available constitutes the minimal data set for the study, and is all that is required to replicate the reported study findings in their entirety.

This is an open access article, free of all copyright, and may be freely reproduced, distributed, transmitted, modified, built upon, or otherwise used by anyone for any lawful purpose. The work is made available under the Creative Commons CC0 public domain dedication.

Introduction

Presenting data that can be quickly interpreted and easily understood is essential in the scientific community. Often, a quick view of a study’s results is the primary source of relaying information and gaining interest, making it critical for the author to consider how it will be interpreted [1–6]. Among other components, the colors chosen to relay data must be considered and applied carefully. Here, we focus on using appropriate colormaps, arrays of colors used in a pre-defined order, for representing i) digitally reconstructed scientific image data, ii) how someone with color vision deficiency (CVD) may be affected by this choice, and iii) how we can create an optimized colormap for those with CVD as well as those without.

CVD reduces the ability to distinguish between certain colors and affects up to 8% of men and 0.5% of women [7, 8]. While this has been known for decades, colormaps that cannot be easily interpreted by those with CVD are still grossly over utilized [9, 10], perhaps because they are often the default colormaps in data processing software. This can cause misinterpretation for certain types of data, even for those with normal color vision (Fig 1) [11]. One possible solution for representing data is to simply switch to grayscale colormaps. Grayscale maps avoid the issues associated with color perception and can provide linear luminance with relation to underlying values. However, grayscale suffers from some viewing condition adaptations and has a small dynamic range due to the lower discernibility of the shades of gray to the human visual system. Humans without CVD can distinguish around ten million different colors versus only about thirty shades of gray [12]. CVD limits this range of colors dramatically (Fig 2), but even limited color vision can make use of the higher dimensionality of colorspace available when using non-grayscale colormaps when they are optimized correctly. This makes color an indispensable component to colormaps, as it enables the ability to see subtle changes in the underlying data (i.e. increases our visual perception precision due to the larger dynamic range).

PPT PowerPoint slide

PowerPoint slide PNG larger image

larger image TIFF original image Download: Fig 1. Example of a misleading colormap. Comparison between different colormaps overlaid onto the test image by Kovesi and a nanoscale secondary ion mass spectrometry image. Colormaps are as follows: (a) perceptually uniform grayscale, (b) jet, (c) jet as it appears to someone with red-green colorblindness, and (d) viridis [1], the current gold standard colormap. Below each NanoSIMS image is a corresponding “colormap-data perceptual sensitivity” (CDPS) plot, which compares perceptual differences of the colormap to actual, underlying data differences. m is the slope of the fitted line and r2 is the coefficient of determination calculated using a simple linear regression. An example of how the data may be misinterpreted are evident in the bright yellow spots in (b) and (c), which appear to represent significantly higher values than the surrounding regions. However, in fact, the dark red (in b) and dark yellow (in c) actually represent the highest values. For someone who is red-green colorblind, this is made even more difficult to interpret due to the broad, bright band in the center of the colormap with values that are difficult to distinguish. https://doi.org/10.1371/journal.pone.0199239.g001

PPT PowerPoint slide

PowerPoint slide PNG larger image

larger image TIFF original image Download: Fig 2. CVD-safe colorspace in CIECAM02-UCS. Visual of how limited color vision is for those with CVD. (a) 2D-representation of area of colorspace accessible to those without (black) and with (gray) complete red-green colorblindness as a function of the CIECAM02-UCS parameters (J′, a′, and b′). (b) Fraction of sRGB colors visible as a function of deuteranomaly severity. A severity of 0 corresponds to normal color vision whereas a severity of 100 corresponds to complete dichromacy (i.e. red-green colorblindness in this case). https://doi.org/10.1371/journal.pone.0199239.g002

Another important consideration for how we view color, with or without CVD, is how we perceive color differences. To represent a color, red-green-blue (RGB) values are most often used, but changes in these values are not linearly proportional to how we perceive color change. The sRGB colorspace was designed for employing RGB values in common digital displays [13] and is the standard space most often used to pass color information (as RGB values), even though it covers a limited portion of colors visible to a human with normal trichromatic (no CVD) vision [14, 15]. Because of its wide applicability and the widespread use of digital displays for viewing scientific data, this is the colorspace we both start from and return to (Fig 3, discussed in Materials and Methods); however, sRGB is not a suitable colorspace for colormap modification since understanding how humans truly perceive difference in color is essential in colormap design.

PPT PowerPoint slide

PowerPoint slide PNG larger image

larger image TIFF original image Download: Fig 3. Script pipeline. Schematic of our script and how it optimizes colormaps for CVD. The colorspace, either sRGB or CIECAM02-UCS, where each operation takes place is shown along with the Python packages specifically required for each step. https://doi.org/10.1371/journal.pone.0199239.g003

One of the first color spaces created to represent actual human perception of color was the CIE 1931 XYZ colorspace created by the International Commission on Illumination (CIE) [16]. This colorspace is still used today and well accepted; however, it does not account for variable viewing conditions. This led to the need for color appearance models (CAMs) which can take viewing conditions into account and use them to create new colorspaces. Phenomena dealt with using CAMs include chromatic and spatial adaptation and changes in the perception of a color due to factors such as hue and contrast changing based on their surroundings. An image appearance model, named iCAM, has also been created as a way to simulate more complex viewing conditions that cannot be achieved with traditional CAMs alone [17].

The comprehensive color appearance model CIECAM02 was created to better account for how we perceive color and is effectively the international gold standard [15, 18]. Luo et al. used this to create a new colorspace, named CIECAM02-UCS (Uniform Color Space), optimized to account for large and small differences in color [19]. In this colorspace, three values are used to describe a color: lightness (J′), a red-green correlate (a′), and a yellow-blue correlate (b′) (Fig 2). Equal Euclidean distances between values in this space leads to an equal color difference perception, enabling the straightforward creation of perceptually uniform colormaps;”perceptually uniform” in that a difference in color space is intended to closely correspond monotonically to human perception of color difference. By converting between sRGB colorspace and CIECAM02-UCS colorspace, we can ensure colormaps are optimized for viewing via modern monitors, which cover sRGB space. This is an important consideration because reading science articles and viewing science data using digital displays is now ubiquitous.

To quantify the perceptual sensitivity of a colormap, we introduce the “colormap-data perceptual sensitivity” (CDPS) plot which is designed to compare perceptual differences to actual, underlying data differences (Fig 1). Specifically, the “Data Δ” is calculated by taking the absolute value of the difference between underlying image data points (in this case, the data points used were along the white line shown in each overlaid image). It is important to note this data has been normalized, but the same normalized image was used for the generation of each overlaid image and CDPS plot. The “Perceptual Δ” is the perceptual difference between colored pixels (calculated as the Euclidean distance between their points in CIECAM02-UCS space) of the overlaid image, normalized by dividing this distance by the slope of the grayscale case. How the overall slope in the CDPS plot compares to greyscale (which always has a slope of 1) indicates how far apart colors within the colormap are. Higher slopes correspond to colormaps that cycle through more colors, and therefore have a higher sensitivity between colors in the map. The coefficient of determination, r2, calculated using a simple linear regression, indicates how well the changes represent the true underlying data differences. High r2 show a better correlation between differences in the underlying data and the perceived color differences (i.e., colormaps with r2 = 1 are perceptually uniform).

Colormaps have been used for almost 150 years [20] and design techniques have steadily evolved throughout this time due to increasing awareness of the effect colormaps can have on data interpretation [4, 5]. For an in-depth review on commonly accepted colormap design methods, please refer to the review by Dr. Peter Kovesi [21], which includes descriptions of different colormap types, the history of colorspace design, best practices for their design, and examples for their use. It is important to note that for this study, we focus on colormaps applicable for typical scalar scientific data, which assumes a need for monotonically increasing colormaps. This is not the case for all data. Non-monotonically increasing colormaps are well accepted for specific types of data, such as using a diverging colormap [21] to represent the correlation between a subject and its reference.

From Kovesi’s review and others [1, 2, 22], there have been a few design principles for creating modern monotonically increasing colormaps. First, a linear increase in lightness should be used to avoid the perception of gradients that are not present. For example, colormaps can quickly change in brightness and hue, causing small changes in the underlying data to seem significant or, in regions where the values change too slowly, large changes to seem negligible. Along with avoiding this banding effect, a linear increase in brightness makes it straightforward to interpret which values are more significant than others and allows direct comparison between values within and (assuming the same scale is used) between images. Second, colors in the colormap should be equidistance from each other in colorspace, ensuring colors perceptually change at a constant rate (i.e., perceptually uniform). Being uniform in this aspect is a quantitative way of preventing regions of the colormap from changing too quickly or too slowly, which helps truly significant changes in data to be visually apparent. Colormaps created using these design principles can be evaluated by using the test image mentioned in Kovesi’s review. This test image works by using a sine wave to iterate through the colors of the colormap, with increasing amplitude toward the top edge of the test image. Areas where the sine wave cannot be easily seen show the presence of regions where the color gradient is too small to properly distinguish the different color values. Additionally, inconsistent presence, or lack thereof, of the sine wave at each amplitude shows varying color gradients throughout the map. Our module, cmaputil, includes a function to create this test image as well as overlay a colormap on it.

While these design principles have led to the development of several wonderful, and increasingly popular, perceptually uniform colormaps (e.g., viridis in matplotlib [1], parula in MATLAB [23], and the cmocean package for oceanography applications [24]), we believe two additional critical design principles should be added. First, J′ should cover as large a range as possible within the bounds dictated by a′ and b′ (and, in the case for monitor-viewable colormaps, without leaving sRGB space), in order to increase perceptual distances between points and further improve the correlation of brightness with higher values. Second, all designs principles should be completed considering CVD.

We created a Python module called cmaputil that can automatically change a pre-defined colormap so that it complies with these recommendations considering a chosen CVD type (deuteranomaly, protanomaly, or tritanomaly). Note that most of those with CVD still have trichromatic vision but have a limited perception of colors due to one cone type having an altered range of sensitivity, causing it to overlap with another cone type, limiting the ability to distinguish colors detected by those two photoreceptors. Complete colorblindness, the most severe form of each type of CVD, is a complete absence of a cone. To our knowledge, our study here is the first to mathematically optimize a colormap specifically for viewing by those both with and without CVD. Below, we discuss the creation of our module and the many considerations that came along with its creation. We also present cividis and explain why we feel it is optimal for the typical scientific data set.