Abstract
Mass spectrometry imaging (MSI) data visualization relies on heatmaps to show the spatial distribution and measured abundances of molecules within a sample. Nonuniform color gradients such as jet are still commonly used to visualize MSI data, increasing the probability of data misinterpretation and false conclusions. Also, the use of nonuniform color gradients and the combination of hues used in common colormaps make it challenging for people with color vision deficiencies (CVDs) to visualize and accurately interpret data. Here we present best practices for choosing a colormap to accurately display MSI data, improve readability, and accommodate all CVDs. We also provide other resources on the misuse of color in the scientific field and resources on scientifically derived colormaps presented herein.
Keywords: colormap, CVD, data visualization, MSI
1. INTRODUCTION
Mass spectrometry imaging (MSI) is an analytical method utilized to measure the two‐ and three‐dimensional spatial distributions of molecules within samples (e.g., biological tissues). 1 , 2 An MSI experiment starts with applying a spatial coordinate system on the surface of the sample. The sample is then iteratively ionized at each coordinate, and the resulting ions generated from the volume of the analyzed sample are pulled into the mass spectrometer and subsequently detected. The lateral resolution of the resulting ion heatmap is dependent on the probe diameter or pitch between probing locations on the tissue in each direction (typically tens to hundreds of micrometers for many ionization sources and even <100 nm for some secondary ion mass spectrometry [SIMS] approaches). 2 , 3 Within the ion heatmap, each mass spectrum is correlated to the coordinate on the tissue where it was measured, allowing the m/z for a specific ion to be extracted and the spatial distribution subsequently visualized. Each volume of analyzed sample is represented in the heatmap by a pixel with the intensity of the measured signal mapped to a color from the user‐defined colormap.
Colormaps are created by defining a sequence of colors. The three core elements that makeup color as established in the Munsell Color System are hue, value, and chroma. 4 The hue is the color of the perceived light itself such as red or blue. Value (also known as luminance or lightness) is the lightness of the color in a range from white to black. Chroma (also known as saturation) is the purity of the hue from a neutral grey. 5 These three elements combine to produce the tens of millions of colors the human eye can perceive. Each of these elements can change the way we see or interpret the color, so careful consideration must be taken when selecting the colors used in colormaps to present scientific data.
Rainbow colormaps such as jet are commonly used to display MSI data because of the wide range of hues used, making the resulting heatmap visually appealing. However, jet and other rainbow colormaps are poor choices for visualizing MSI data because (1) they do not contain perceptually linear color gradients and thus are not quantitative, (2) the hue used along the colormap does not inherently show relative signal intensity, and (3) they make data interpretation significantly harder for people with color vision deficiencies (CVDs) or color blindness. 6 , 7 , 8 , 9 Color vision in humans is trichromatic because there are three color photoreceptors responsible for the perception of color. These photoreceptors contain one of three different photopigments that are classified as short‐ (S), medium‐ (M), and long‐wavelength (L) sensitive pigments that correlate to the sensitivity to blue, green, and red light, respectively. 10 Dichromacy is a severe form of CVD where one photopigment is absent resulting in a loss of function in the corresponding cone. 11 Color is then perceived by the remaining two functional cones. Protanopia is when there is a complete loss of function of the L‐cones, and deuteranopia is the complete loss of function of the M‐cones. Both of these CVDs lead to confusion between hues of red and green. Tritanopia is the loss of function in the S‐cones, making it difficult for the affected to differentiate between hues of blue and yellow. Less severe but more common forms of CVD are protanomaly (1.08% of males of European descent), deuteranomaly (4.63%), and tritanomaly (0.02%) which results in decreased sensitivity of the affected cone. 11 Approximately 8% of European males and <1% of females have some form of CVD, increasing the difficulty of quantitative data interpretation, especially when using a rainbow colormap. 11 , 12 , 13 , 14 Therefore, there is a need for the heatmaps generated from an MSI study to utilize colormaps that are both perceptually linear and CVD‐friendly.
Scientifically derived colormaps have been created with a perceptually linear color gradient even for people with CVDs. 6 , 7 , 9 The cividis colormap was created by Nuñez and coworkers to be perceptually uniform, easily readable, and CVD‐friendly. 7 There is additional literature on the importance of color for visualizing scientific data, visualizing MSI data, and optimizing new colormaps for data visualization. 6 , 8 , 15 , 16 , 17 Nevertheless, rainbow colormaps are still commonly used by the MSI community. Herein, we present a tutorial on selecting colormaps to accurately display MSI data while remaining CVD‐friendly.
2. TUTORIAL
An appropriate colormap is essential for the accurate and precise display of MSI data. Otherwise, the images are only pictures with little quantitative value and can even be misleading. The colormap used in MSI heatmaps should be easily readable and perceptually linear, meaning the change in signal and the perceived color change are uniform over the entire color gradient. Many MSI heatmaps found in the literature are generated using rainbow colormaps because they contain a wide range of hues and are aesthetically attractive but also contain arbitrary extrema of brightness and are not perceptually linear. These two disadvantages of rainbow colormaps can confuse the reader, increase the difficulty of data interpretation, and are not an accurate visualization of the measured ion intensity within a sample. There are many perceptually linear colormaps that are accessible and more accurately display MSI data.
The heatmap of glutathione (GSH, [M‐H]− = m/z 306.0765) abundance normalized to the abundance of homoglutathione (hGSH, [M‐H]− = m/z 320.0922) measured by infrared matrix‐assisted laser desorption electrospray ionization (IR‐MALDESI)‐MSI from a section of mouse liver was generated using the jet colormap and is shown in Figure 1A. 18 Homoglutathione was sprayed on the sample's microscope slide prior to sample mounting. The normalized GSH abundance is a relative quantification for GSH concentration within the tissue. Heatmaps were then generated for a subsection of the resulting image using jet, hot, greyscale, and cividis. The color scale for each colormap utilized and their respective Kovesi test images are shown in Figure 1B. The color scale is transformed with a sine wave to create the respective Kovesi test image to identify regions of nonlinear color gradients where the sine transform is indistinguishable. Two pairs of the most abundant pixels in the heatmap subsection are shown in Figure 1C with the normalized GSH abundance value displayed over each pixel. The extracted pixels from the jet and cividis colormaps are plotted on a number line in Figure 1D.
FIGURE 1.

(A) Heatmap of glutathione (GSH) abundance normalized to homoglutathione (hGSH) abundance from mouse liver generated using jet. The zoomed‐in region of interest is also shown with the hot, cividis, and greyscale colormaps. (B) The color scales for jet, hot, cividis, and greyscale (left) and their respective Kovesi test images (right). (C) The color and the measured signal of two sets of pixels were extracted from each heatmap. (D) Extracted pixels displayed on a number line with the quantitative distance and perceptual distance calculated between each pair.
The many hues used within the jet colormap make determining the relative abundance of glutathione difficult as there is not a linear change in color or luminance (Figure 1A), and the ordering of colors is not obvious. 19 The nonlinear regions of each colormap can be identified from the Kovesi test images made by transforming the color values of each colormap with a sine function (Figure 1B). 20 Regions, where the sine wave is difficult to identify, indicate where the localized color gradient is too small to differentiate between neighboring color values. Also, human attention is drawn most to color and high luminance, meaning the reader's eyes are drawn to the arbitrarily bright regions of yellow and green (normalized GSH abundance = ~2.16) instead of the more abundant dark red regions (normalized GSH abundance = ~5.39). 21 , 22 Finally, the 3.55 yellow pixel changes to the dark red 4.94 pixel (quantitative distance = 1.39), but lower in the color gradient with the same abundance difference (quantitative distance = 1.33), green changes to orange (Figure 1D). The same change in abundance should result in identical perceptual differences, but this is not the case with the jet colormap. The transition from green to orange and from yellow to red has perceptual distances of 47.5 and 57.0, respectively, indicating that the changes are perceptually different even though the change in signal is the same (Figure 1D). This color change with respect to signal change is arbitrary, misleading, and shows why multiple hues can confound data interpretation. Perceptual distance calculations were performed using the cmaputil module (https://github.com/pnnl/cmaputil/blob/master/cmaputil/cmaputil.py) as described in work by Nuñez et al. 7
The hot colormap is gaining popularity within the MSI community and has a linear color gradient; however, it is not a perceptually linear color gradient, meaning each RGB value used within each color of the colormap increases linearly, but the resulting gradient is not perceptually uniform (Figure 1B). 9 The color differences between the four selected pixels generated using hot are nearly linear. However, hot is not perceptually linear across the entire color gradient making it nonoptimal for data visualization. Greyscale is not an esthetically pleasing colormap; however, it contains a perceptually linear color gradient and is always a better alternative to rainbow heatmaps. Cividis is a scientifically derived colormap with a perceptually linear color gradient optimized to display scientific data. 7 The heatmap generated with cividis naturally draws your eyes to the more abundant pixels. There is also a clear, similar perceptual color difference between the two pairs of pixels shown in Figure 1D (perceptual distance = 24.8 and 25.9).
While some heatmaps might appear perceptually uniform, the hues used can make data interpretation difficult for people with CVDs. The previously shown heatmap of GSH analyzed in mouse liver generated using jet, hot, greyscale, and cividis is shown in Figure 2. Additionally, each heatmap was then transformed using Dalton Lens (https://daltonlens.org/#software), a CVD simulation software, to show how someone with each dichromacy (protanopia, deuteranopia, and tritanopia) would perceive the resulting heatmaps. Each CVD perceives the jet heatmap differently because jet uses every hue within the rainbow. Also, the many hues of jet and localized regions of high luminance draw the reader's attention to regions of moderate abundance (normalized GSH abundance = ~2.16). The use of hot results in the perception of a completely different heatmap for people with each CVD but preserves the nonuniform color gradient making it suboptimal. Greyscale is perceived the same across all the CVDs and by people without CVD while remaining perceptually linear. Cividis was created using a perceptually linear color gradient from blue to yellow, meaning that people with deuteranopia and protanopia can visualize the heatmap exactly like someone without a CVD. Deuteranopia and protanopia are the most common CVDs, so most of the CVD community is unaffected by cividis. For people with tritanopia, the perceived colormap is off‐gray, but the color gradient remains perceptually linear.
FIGURE 2.

Matrix of heatmaps showing glutathione (GSH) abundance normalized to homoglutathione (hGSH) abundance analyzed from mouse liver by IR‐MALDESI‐MSI. Each column shows the heatmap generated using common colormaps used to visualize mass spectrometry imaging (MSI) data. Each row is the simulated perception of each heatmap for each color vision deficiency (CVD) (protanopia, deuteranopia, and tritanopia) and for a person without a CVD.
The proper use of color is critical for the visualization and interpretation of MSI data. Cividis is a preferred colormap to visualize scientific data because it is perceptually linear even for people with CVDs. Other scientifically derived colormaps such as magma, inferno, plasma, viridis, and batlow are good alternatives as they are often found to be more esthetically pleasing and have a larger (but still uniform) perceptual distance between colors (https://bids.github.io/colormap/). Sampling colors from these other colormaps is great for making categorical figures such as bar plots because the larger perceptual distance between the colors makes the extracted colors stand out from one another. For additional information on colormap selections, Crameri and coworkers published an in‐depth perspective on the misuse of color in scientific data and how to effectively select a colormap for any data visualization tool type. 6 Race and Bunch have also published rules and metrics for designing CVD‐friendly colormaps specific to MSI data. 9 Finally, Nuñez and coworkers published methods and open‐source software to optimize an input colormap so that custom‐perceptually linear and CVD‐friendly colormaps can be generated for the user. 7
As scientists, we aim to carefully interpret and communicate information. Choosing an effective colormap is one way the MSI community can accurately present data that is easily readable by all.
CONFLICT OF INTEREST
The authors declare no competing financial interests.
ACKNOWLEDGEMENT
We thank Allyson Mellinger for providing the MSI data presented herein. The authors greatfully acknowledge the financial support received from the National Institutes of Health (R01GM087964).
Knizner KT, Kibbe RR, Garrard KP, Nuñez JR, Anderton CR, Muddiman DC. On the importance of color in mass spectrometry imaging. J Mass Spectrom. 2022;57(12):e4898. doi: 10.1002/jms.4898
DATA AVAILABILITY STATEMENT
N/A.
REFERENCES
- 1. Amstalden van Hove ER, Smith DF, Heeren RMA. A concise review of mass spectrometry imaging. J Chromatogr a. 2010;1217(25):3946‐3954. doi: 10.1016/j.chroma.2010.01.033 [DOI] [PubMed] [Google Scholar]
- 2. Buchberger AR, DeLaney K, Johnson J, Li L. Mass spectrometry imaging: a review of emerging advancements and future insights. Anal Chem. 2018;90(1):240‐265. doi: 10.1021/acs.analchem.7b04733 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3. Nuñez J, Renslow R, Cliff JB, Anderton CR. NanoSIMS for biological applications: current practices and analyses. Biointerphases. 2018;13(3):03B301. doi: 10.1116/1.4993628 [DOI] [PubMed] [Google Scholar]
- 4. Munsell AH. A pigment color system and notation. Am J Psychol. 1912;23(2):236. doi: 10.2307/1412843 [DOI] [Google Scholar]
- 5. Cochrane S. The Munsell color system: a scientific compromise from the world of art. Stud Hist Philos Sci Part A. 2014;47:26‐41. doi: 10.1016/j.shpsa.2014.03.004 [DOI] [PubMed] [Google Scholar]
- 6. Crameri F, Shephard GE, Heron PJ. The misuse of colour in science communication. Nat Commun. 2020;11(1):5444. doi: 10.1038/s41467-020-19160-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7. Nuñez JR, Anderton CR, Renslow RS. Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data. PLoS One. 2018;13(7):e0199239. doi: 10.1371/journal.pone.0199239 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8. Brewer CA. Color use guidelines for mapping and visualization. In: Modern cartography series. 1994:123‐147. [Google Scholar]
- 9. Race AM, Bunch J. Optimisation of colour schemes to accurately display mass spectrometry imaging data based on human colour perception. Anal Bioanal Chem. 2015;407(8):2047‐2054. doi: 10.1007/s00216-014-8404-5 [DOI] [PubMed] [Google Scholar]
- 10. Simunovic, M.P. Colour vision deficiency. Eye. 24, 747–755 (2010). doi: 10.1038/eye.2009.251 [DOI] [PubMed] [Google Scholar]
- 11. Sharpe LT, Stockman A, Jägle H, Nathans J. Opsin genes, cone photopigments, color vision, and color blindness. Genetics. 1999;50. [Google Scholar]
- 12. Stockman A, Sharpe LT. The spectral sensitivities of the middle‐ and long‐wavelength‐sensitive cones derived from measurements in observers of known genotype. Vision Res. 2000;40(13):1711‐1737. doi: 10.1016/S0042-6989(00)00021-3 [DOI] [PubMed] [Google Scholar]
- 13. Birch J. Worldwide prevalence of red‐green color deficiency. J Opt Soc am a. 2012;29(3):313‐320. doi: 10.1364/JOSAA.29.000313 [DOI] [PubMed] [Google Scholar]
- 14. Lin H‐Y, Chen L‐Q, Wang M‐L. Improving discrimination in color vision deficiency by image re‐coloring. Sensors. 2019;19(10):2250. doi: 10.3390/s19102250 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15. Stauffer R, Mayr GJ, Dabernig M, Zeileis A. Somewhere over the rainbow: how to make effective use of colors in meteorological visualizations. Bull am Meteorol Soc. 2015;96(2):203‐216. doi: 10.1175/BAMS-D-13-00155.1 [DOI] [Google Scholar]
- 16. Thyng K, Greene C, Hetland R, Zimmerle H, DiMarco S. True colors of oceanography: guidelines for effective and accurate colormap selection. Oceanography. 2016;29(3):9‐13. doi: 10.5670/oceanog.2016.66 [DOI] [Google Scholar]
- 17. Stoelzle M, Stein L. Rainbow color map distorts and misleads research in hydrology—guidance for better visualizations and science communication. Hydrol Earth Syst Sci. 2021;25(8):4549‐4565. doi: 10.5194/hess-25-4549-2021 [DOI] [Google Scholar]
- 18. Mellinger AL, Garrard KP, Khodjaniyazova S, Rabbani ZN, Gamcsik MP, Muddiman DC. Multiple infusion start time mass spectrometry imaging of dynamic SIL‐glutathione biosynthesis using infrared matrix‐assisted laser desorption electrospray ionization. J Proteome Res. 2021;21(3):747‐757. doi: 10.1021/acs.jproteome.1c00636 [DOI] [PubMed] [Google Scholar]
- 19. Borland D, Taylor Ii RM. Rainbow color map (still) considered harmful. IEEE Comput Graph Appl. 2007;27(2):14‐17. doi: 10.1109/MCG.2007.323435 [DOI] [PubMed] [Google Scholar]
- 20. Kovesi P. Good colour maps: how to design them. CORR. 2015;1‐41. doi: 10.48550/arxiv.1509.03700 [DOI] [Google Scholar]
- 21. Alexander KR, Shansky MS. Influence of hue, value, and chroma on the perceived heaviness of colors. Percept Psychophys. 1976;19(1):72‐74. doi: 10.3758/BF03199388 [DOI] [Google Scholar]
- 22. Wolfe JM, Horowitz TS. Five factors that guide attention in visual search. Nat Hum Behav. 2017;1(3):0058. doi: 10.1038/s41562-017-0058 [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
N/A.
