Martin Krzywinski / Genome Sciences Center / Martin Krzywinski / Genome Sciences Center / - contact me Martin Krzywinski / Genome Sciences Center / on Twitter Martin Krzywinski / Genome Sciences Center / - Lumondo Photography Martin Krzywinski / Genome Sciences Center / - Pi Art Martin Krzywinski / Genome Sciences Center / - Hilbertonians - Creatures on the Hilbert Curve
Sun is on my face ...a beautiful day without you.Royskoppbe apartmore quotes

EMBO Practical Course: Bioinformatics and Genome Analysis, 5–17 June 2017.

visualization + design

Some of the images in this writeup are part of Ana Swanson's Wonk Blot post How a dog sees a rainbow, and 12 other images that explain how we see color at the Washington Post.

Color Palettes for Color Blindness

In an audience of 8 men and 8 women, chances are 50% that at least one has some degree of color blindness1,2. When encoding information or designing content, use colors that is color-blind safe.

1About 8% of males and 0.5% of females are affected with some kind of color blindness in populations of European descent (wikipedia, Worldwide prevalence of red-green color deficiency, JOSAA). The rate for other races is lower Asians and Africans is lower (Caucasian Boys Show Highest Prevalence of Color Blindness Among Preschoolers, AAO).

2The probability that among `N=8` men and `N=8` women at least one person is affected by color blindness is `P(men,women) = P(8,8) = 1 - (1-0.08)^8 * (1-0.005)^8 = 0.51`. For `N=34` (i.e., 68 people in total), this probability is `P(34,34)=0.95`. Because the rate of color blindness in women is so low, for most groups of mixed gender we can approximate the probability by only counting the men. For example, in a group of 17 women the probability that at least one of them is color blind is `P(0,17) = 0.082`, which is the same probability as for 1 man, `P(1,0)`.

Color Oracle is a good and free color blindness simulator for Windows, Mac and Linux.

color blindness RGB transformation tables

You can download the RGB transformation table for deuteranopia, protanopia and tritanopia. It is available for all (r,g,b) colors in steps of 5 in each of the channels. The mapping for all other RGB colors can be interpolated.

Transformation for all 16.8 million RGB colors (interpolated from the table above) are also available independently for each type of color blindness: deuteranopia, protanopia, and tritanopia.

color receptors are reduced or absent in color blindness

The normal human eye is a 3-channel color detector3. There are three types of photoreceptors, each sensitive to a different part of the spectrum. Their combined response to a given wavelength produces a unique response that is the basis of the perception of color.

3Compared to hearing, the color vision is a primitive detector. While we can hear thousands of distinct frequencies and process them simultaneously, we have only three independent color inputs. While the ear can distinguish pure tones from complex sounds that have multiple frequencies the eye is relatively unsophisticated in separating a color sensation into its three constituent primary stimuli.

People with color blindness have one of the photo receptor groups either reduced in number or entirely missing. With only two groups of photoreceptors, the perception of hue is drastically altered.

For example, in deuteranopia, the most common type of color blindness, the medium (M) wavelength photoreceptors are reduced in number or missing. This results in the loss of perceived difference between reds and greens because only one group of photoreceptors (L) are sensitive to the wavelengths of these colors. The spectrum appears to be split into two hues along the blue-green boundary (see figure below).

Color photoreceptor profile for color blindness and the appearance of art and objects. / Martin Krzywinski @MKrzywinski
Each of the three kinds of color blindness are associated with reduced number of each of the three kinds of photoreceptors. In extreme cases, a given type of photoreceptors may be missing. To people with color blindness, objects appear very differently. Artwork is (left) Edvard Munch, Scream (Skrik), 1893, National Gallery, Oslo, Norway (right) Claude Monet, Coquelicots, La promenade (Poppies), 1873, Musée d'Orsay, Paris. (zoom)

Visible light is in the range of 390-700 nm. The exact definition of the upper limit varies, with some sources giving as high as 760 nm. Shorter wavelengths are absorbed by the cornea (<295nm) and lens (315-390nm). Some near infrared light also reaches the retina (760-1400nm).

super color vision

The opposite condition to color blindness exists too—tetrachromacy. In this case, an individual has an extra type of color receptor which improves discrimination in the red part of the spectrum. While the anatomy of their retina can be described, how true tetrachromats subjectively perceive color is unknown. And, perhaps, even unknowable.

Tetrachromacy is common in other animals, such as fish (e.g. goldfish, zebrafish) and birds (e.g. finch, starling). The dimensionality of the perceived color space isn't necessarily proportional to the number of different receptors. If the signal from 3 color receptors are combined by the brain and each processor has a weighted response to a broad range of wavelengths, then a color can be modeled by a point in 3-dimensional space, in which the receptors are the axes. This system can perceive a large number of colors.

In the extreme case where the receptors respond to a very narrow range, of which none overlap with the other, a color is one of three points in a 1-dimensional space. This sytem can perceive only 3 colors.

For example, although the mantis shrimp has 12 different color receptors, the receptors work independently, their color discrimination is poorer than ours.

it's all the same to me

Color palette for color blindness. / Martin Krzywinski @MKrzywinski
Sets of representative hues and tones that are indistinguishable to individuals with different kinds of color blindness. The rectangle below the each color pair shows how the colors appear to someone with color blindness.

If you use Color Oracle to transform your screen colors to simulate color blindness, you can see that none of the equivalent swatches in one kind of color blindness are equivalent in another. This is particularly interesting when applied to a duotone image which is drawn using equivalent colors. In the figure below4, a row of Mr. Spocks disappears (or is difficult to see) to people with color blindness.

Spock, indistinguishable to people with color blindness. / Martin Krzywinski @MKrzywinski
The likeness of Mr. Spock drawn using equivalent colors (see image above) for each of the three kinds of color blindness. Image from imagebuddy.

4In tribute to Leonard Nimoy, 1931–2015

conservative 7-color palettes for color blindness

To people with color blindness, some colors appear the same. This equivalence can be used to identify distinct colors which are unique to those with normal and color blind vision.

The seven colors (and black) in the figure below are perceived as reasonably distinct by both normal and color blind individuals. The table on the left is reproduced from Nature Method's Points of View: Color blindness by Bang Wong.

Color palette for color blindness. / Martin Krzywinski @MKrzywinski
(left) 7-color palette for color blindness, from Wong, B. (2011) Nature Methods 8:441. (right) The same palette ordered by hue and tone for a deuteranope. (zoom, PDF)

For more tips about designing with color blindness in mind, see Color Universal Design (CUD) — How to make figures and presentations that are friendly to Colorblind people.

12-color palettes for color blindness

The figure below shows the mapping of different colors to six different grades of each of the two hues seen by deuteranopes. It offers more distinct options than the 7-color palette above.

Color palette for color blindness. / Martin Krzywinski @MKrzywinski
(left) Colors grouped by equivalence of perception in deuteranopes. Each of the two hues is represented in six different brightness and chroma combinations. (right) One of the subsets of colors on the left that are reasonably distinct in both deuteranopia and protanopia. To tritanopes, three of the pairs are difficult to distinguish. (zoom, PDF)

15-color palettes for color blindness

Even more color choices for color blindess, including colors that map onto greys.

If you're looking to encode quantitative information, I suggest using the subset of Brewer palettes that are safe for color blindess (e.g. pink-yellow-green, brown-blue-green).

15-color palettes for color blindness / Martin Krzywinski @MKrzywinski
15-color palettes designed for each of the three types of color blindness: deuteranopia, protanopia and tritanopia. Palettes are shown as they appear to someone with normal vision as well as to someone affected with each of the three types of color blindness. Each palette contains three groups of swatches, matching to two of the color channels and greys. Within each group colors in the same row map onto the same color. (zoom, PDF)

news + thoughts

Tabular Data

Tue 11-04-2017
Tabulating the number of objects in categories of interest dates back to the earliest records of commerce and population censuses.

After 30 columns, this is our first one without a single figure. Sometimes a table is all you need.

In this column, we discuss nominal categorical data, in which data points are assigned to categories in which there is no implied order. We introduce one-way and two-way tables and the `\chi^2` and Fisher's exact tests.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Tabular data. Nature Methods 14:329–330.

...more about the Points of Significance column

Happy 2017 `\pi` Day—Star Charts, Creatures Once Living and a Poem

Tue 14-03-2017

on a brim of echo,

capsized chamber
drawn into our constellation, and cooling.
—Paolo Marcazzan

Celebrate `\pi` Day (March 14th) with star chart of the digits. The charts draw 40,000 stars generated from the first 12 million digits.

Martin Krzywinski @MKrzywinski
12,000,000 digits of `\pi` interpreted as a star catalogue. (details)

The 80 constellations are extinct animals and plants. Here you'll find old friends and new stories. Read about how Desmodus is always trying to escape or how Megalodon terrorizes the poor Tecopa! Most constellations have a story.

Martin Krzywinski @MKrzywinski
Find friends and stories among the 80 constellations of extinct animals and plants. Oh look, a Dodo guardings his eggs! (details)

This year I collaborate with Paolo Marcazzan, a Canadian poet, who contributes a poem, Of Black Body, about space and things we might find and lose there.

Check out art from previous years: 2013 `\pi` Day and 2014 `\pi` Day, 2015 `\pi` Day and and 2016 `\pi` Day.

Data in New Dimensions: convergence of art, genomics and bioinformatics

Tue 07-03-2017

Art is science in love.
— E.F. Weisslitz

A behind-the-scenes look at the making of our stereoscopic images which were at display at the AGBT 2017 Conference in February. The art is a creative collaboration with Becton Dickinson and The Linus Group.

Its creation began with the concept of differences and my writeup of the creative and design process focuses on storytelling and how concept of differences is incorporated into the art.

Oh, and this might be a good time to pick up some red-blue 3D glasses.

BD Genomics 3D art exhibit - AGBT 2017 / Martin Krzywinski @MKrzywinski
A stereoscopic image and its interpretive panel of single-cell transcriptomes of blood cells: diseased versus healthy control.

Interpreting P values

Thu 02-03-2017
A P value measures a sample’s compatibility with a hypothesis, not the truth of the hypothesis.

This month we continue our discussion about `P` values and focus on the fact that `P` value is a probability statement about the observed sample in the context of a hypothesis, not about the hypothesis being tested.

Martin Krzywinski @MKrzywinski
Nature Methods Points of Significance column: Interpreting P values. (read)

Given that we are always interested in making inferences about hypotheses, we discuss how `P` values can be used to do this by way of the Benjamin-Berger bound, `\bar{B}` on the Bayes factor, `B`.

Heuristics such as these are valuable in helping to interpret `P` values, though we stress that `P` values vary from sample to sample and hence many sources of evidence need to be examined before drawing scientific conclusions.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Interpreting P values. Nature Methods 14:213–214.

Background reading

Krzywinski, M. & Altman, N. (2017) Points of significance: P values and the search for significance. Nature Methods 14:3–4.

Krzywinski, M. & Altman, N. (2013) Points of significance: Significance, P values and t–tests. Nature Methods 10:1041–1042.

...more about the Points of Significance column