Lessons › Lesson 4
Seeing the data: colour, order and the eye
A shot is thousands of numbers, a line millions. Nobody reads them one by one: we look at pictures of them. A good picture lets the eye find what matters at a glance. A poor one hides it - or shows something that is not there at all. This lesson is about making the picture honest and easy to read: how the eye works, which colours to use, and in what order to put things.
1Why draw the data at all
In 1973 the statistician Francis Anscombe published four small sets of numbers - eleven points each - to answer a view he found common among statisticians: that "numerical calculations are exact, but graphs are rough". The four sets have the same summary, to two or three decimals:
| In all four sets | Mean of x | Variance of x | Mean of y | Variance of y | Correlation | Best-fit line |
|---|---|---|---|---|---|---|
| Value | 9 | 11 | 7.50 | 4.125 | 0.816 | y = 3.00 + 0.500 x |
Anyone who read only those figures would say the four sets are the same. Drawn, they are four different things:
The same on a vessel
Here are the timing errors of eight guns over twelve shots - each gun's fire time minus its aim point, in milliseconds, with a limit of ±1.0 ms. Look at the numbers first: is any gun drifting, and is any reading outside the limit? Then switch to the picture.
| Gun | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | −0.2 | −0.2 | −0.1 | −0.2 | −0.3 | −0.1 | +0.3 | +0.2 | +0.2 | −0.2 | 0.0 | −0.1 |
| 2 | −0.2 | −0.2 | −0.2 | +0.3 | +0.2 | +0.2 | +0.2 | −0.2 | −0.1 | +0.1 | +0.1 | +0.2 |
| 3 | +0.2 | −0.2 | +0.1 | +0.1 | 0.0 | −0.2 | 0.0 | −0.2 | +0.3 | +0.2 | 0.0 | −0.1 |
| 4 | +0.2 | 0.0 | +0.2 | +0.2 | 0.0 | −0.1 | +0.1 | 0.0 | −0.2 | −0.1 | +0.2 | −0.3 |
| 5 | −0.3 | +0.1 | −0.1 | 0.0 | 0.0 | −0.1 | +0.3 | −0.2 | −0.1 | −0.2 | +0.1 | −0.1 |
| 6 | −0.1 | +0.1 | −0.1 | 0.0 | +0.3 | +0.4 | +0.6 | +0.6 | +0.7 | +0.9 | +1.0 | +1.2 |
| 7 | −0.3 | −0.1 | +0.3 | +0.2 | −0.1 | +0.3 | +0.1 | +0.2 | −0.1 | −0.2 | 0.0 | −0.2 |
| 8 | −0.1 | +0.3 | −0.1 | −0.3 | −0.3 | −0.2 | +0.2 | −0.1 | −0.1 | −0.2 | +0.3 | 0.0 |
Ninety-six numbers. The answer is in them - but the eye has to read every one, compare it with the others and remember. Try to find it before you switch.
Gun 6 turns amber from about shot 5 and deepens shot by shot: it is drifting late. Its last reading, +1.2 ms, is past the limit, and it is the only red cell. The same numbers, found in a second.
The idea to keepNumbers are for looking things up; pictures are for seeing. Summaries can agree while the data does not - draw it before you trust it.
2What the eye sees first
Some differences are seen before you look for them. A mark of another colour in a field of grey, a square among circles, a line at another angle: they pop out. Psychologists who study visual search find that for a target that differs in one feature, how long it takes to find it hardly depends on how many other marks there are.
A target that differs only in a combination of features - a blue square among blue circles and grey squares - does not pop out. The eye has to check the marks one by one, and the more marks, the longer it takes. Treisman and Gelade described this in 1980, in their feature integration theory.
Try it: find the odd one
Pick what makes the odd mark different and how many marks there are, then click the odd one as fast as you can. The page reads the clock when the field is drawn and when you click; nothing is kept.
- Colour alone
- -
- Shape alone
- -
- Colour and shape
- -
- Marks in the field
- -
The search demo needs JavaScript; the two paragraphs above say what it shows.
Which pictures are read most accurately
Seeing that something is different is one task; reading how much is another. In 1984 William Cleveland and Robert McGill, at Bell Labs, ranked the ways a chart can encode a number by how accurately people read them back - from most to least accurate:
- Position along a common scale - dots or bar ends against one axis
- Position along scales that are not aligned - the same, in separate panels
- Length, direction, angle
- Area
- Volume, curvature
- Shading and colour saturation
Colour comes last for reading a value. It is still the best way to show a pattern over thousands of cells - a heat map of guns against shot points - because there is no room there for a chart per gun. So a heat map needs a way back to the number: a value under the pointer, a table, a chart of the one gun that looks wrong.
The idea to keepMake what matters differ in one feature, so it pops out. Let position carry the numbers, and colour carry the pattern.
3Three jobs for colour
Before choosing colours, ask what the colour has to say. There are three main answers, and each has its own kind of colour map - the same three that ColorBrewer, a tool made for maps, offers:
- Sequential: how much. In the words of matplotlib's guide, sequential maps "change in lightness and often saturation of color incrementally, often using a single hue; should be used for representing information that has ordering." A channel's noise level, a shot's energy, a count.
- Diverging: which side, and how far. Two hues "that meet in the middle at an unsaturated color; should be used when the information being plotted has a critical middle value, such as topography or when the data deviates around zero." Seismic amplitude, a gun's depth minus its target, fire time minus aim point. The middle must be the value that means "nothing" - zero, the target, the median.
- Qualitative: which one. Separate hues with no order: they "should be used to represent information which does not have ordering or relationships." Sources, sub-arrays, lines. Keep them few: the more hues, the closer the neighbours, and the harder to tell apart.
There is a fourth, rarer kind: cyclic maps, which end where they begin - "for values that wrap around at the endpoints, such as phase angle, wind direction, or time of day".
The idea to keepFirst ask what the colour must say - how much, which side, or which one - and the kind of map follows.
4The rainbow trap
For years the most familiar colour map in science was the rainbow: dark blue, blue, cyan, green, yellow, red, dark red. Many common programs once used it as their default, which is one reason it is still everywhere. It looks rich. It also misleads, and the reason is lightness.
The eye reads changes in lightness as changes in the data far better than changes in hue. matplotlib's guide puts it plainly: "colormaps which have monotonically increasing lightness through the colormap will be better interpreted by the viewer." The rainbow's lightness does not rise - it climbs from dark blue to bright cyan and yellow, then falls again to dark red:
- It draws edges that are not there. Where the lightness turns, smooth data looks banded. Crameri, Shephard and Heron wrote in 2020 that a rainbow map "adds artificial boundaries to some parts of the data range, hiding small-scale variations elsewhere".
- It points the eye at the middle. "In rainbow colour maps, the yellow is the brightest colour and attracts the eye the most" - so the most noticed values are not the largest ones.
- It loses its order in print. In grey, the low and the high ends both come out dark. matplotlib's guide says that maps "such as Accent, hsv, jet and turbo, change from darker to lighter and back to darker grey throughout the colormap. This would make it impossible for a viewer to interpret the information in a plot once it is printed in grayscale."
The remedy is a perceptually uniform map: one "in which equal steps in data are perceived as equal steps in the color space". The best known is viridis, designed by Stéfan van der Walt and Nathaniel Smith to be "perfectly perceptually-uniform, both in regular form and also when converted to black-and-white", and chosen as matplotlib's default colour map from version 2.0.
Try it: one field, four colour maps
Two made-up data sets: a smooth field with two dents of exactly the same depth - a quantity that only grows - and the amplitudes of a synthetic shot gather, signed, with zero for no signal and its first event, a compression, negative - the SEG way. Pick a map, then see it as a colour-blind reader would, or printed in grey. Under the colour bar, the line is the map's lightness.
- Its lightness
- -
- The middle is
- -
- Right for this data
- -
- Seen as
- -
The colour map demo needs JavaScript; the drawing above shows the two maps it compares.
The idea to keepChoose a map whose lightness follows the data: rising for how much, lightest (or darkest) at the middle for which side. If it does not survive grey print, it does not show the order.
5Not everyone sees the same colours
Red-green colour blindness affects up to 1 in 12 men (8 %) and 1 in 200 women (0.5 %). If 8 % of men have it, the chance that at least one of a crew of 25 men does is 1 − 0.9225, about 88 % - so somebody reading your plot probably does.
For them, a red and a green of similar lightness look alike. Here is a pair of status lights as three people see them - the colours below are computed with the simulation of Machado, Oliveira and Fernandes (2009), the same one the demo above uses:
- Never let red against green carry a meaning alone. matplotlib's guide: "The most common form of color vision deficiency involves differentiating between red and green. Thus, avoiding colormaps with both red and green will avoid many problems in general."
- Add a second channel - a word, a symbol, a position, a pattern, or a clear difference in lightness.
- Check it. Look at your picture through a colour-blindness simulator, and print it in grey once.
The idea to keepColour is a help, never the only way. If the meaning is lost in grey or to a colour-blind eye, it needs a second channel.
6One colour, one meaning
Once a colour means something, it has to mean it everywhere - on every chart of the screen and on every page of the report. A reader learns a colour once and then trusts it.
- Give red one job. Red reads as a warning. SEG‑D Monitor's End of Line report keeps red for a reading outside its limits and nothing else; a difference from a line's median - interesting, not wrong - is drawn blue and amber. The timing table in part 1 does the same: one red cell, the one reading past the limit.
- The same thing, the same colour. If source 1 is blue on one chart, it is blue on all of them. When one source is hidden, the others keep their colours - a colour that moves with a filter teaches the reader something false.
- Put the middle where it means "nothing". A diverging map is centred on zero, the target or the median - with the same reach on both sides. If the scale is set by the data alone, the white middle drifts off zero, and "on target" no longer looks like it.
- Say what the colours mean. A colour bar with units, a legend, labels on the lines - so no one has to guess.
The idea to keepDecide what each colour means, write it on the chart, and never let it mean anything else.
7Order shows the pattern
The order of the rows and columns is as much a choice as the colours - and it decides what can be seen. A few rules:
- Sort by the value you want compared. A bar chart of guns sorted by their error shows the worst at once; sorted by name, it shows the alphabet.
- Bring together what belongs together. Guns of one sub-array, channels of one streamer, side by side. In 1967 the French cartographer Jacques Bertin, in Sémiologie graphique, gave a way to reorder - seriate - a table's rows and columns until its pattern appears: the Bertin matrix.
- Keep the natural order where the order means something. Time, shot point, position along the string. Never sort the shots of a line by value: the line's story is in their order - when a gun began to drift, where the swell came in.
- Beware sorting numbers as text. A computer comparing names character by character puts "10" before "2", because "1" comes before "2": G1, G10, G11 … G2. Natural sort order treats a number inside a name as a number.
Try it: sort the rows
A made-up gun-by-shot-point map: 24 guns, 80 shot points, each cell a gun's depth minus its target - blue shallower, amber deeper. Three things are hidden in it. The guns are numbered across the three sub-arrays (G1 in sub-array 1, G2 in sub-array 2, G3 in sub-array 3, G4 in sub-array 1 …), and the coloured tag beside each name says which. Point at a cell to read it.
- Rows in order
- As listed
- The first rows
- -
- Under the pointer
- -
The sorting demo needs JavaScript; the rules above are what it shows.
The idea to keepSort the rows to bring alike together. Never sort time.
8Sorting seismic traces: gathers
In seismic, "sorting" has a second meaning. Every trace belongs to one shot and one receiver, and traces can be grouped by anything they share. Each group is a gather, and each gather shows some things better than others:
| Gather | The traces that share | Good for |
|---|---|---|
| Common shot | one shot, many receivers | "very easy to inspect traces in these displays for bad receivers or bad shots" |
| Common receiver | one receiver, many shots | a basic check of the acquisition, like the shot gather |
| Common midpoint (CMP) | one midpoint between source and receiver | velocity analysis and moveout correction, then stacking: the traces are sorted by offset |
| Common offset | one source-receiver distance | "basic quality control, because it approximates a structural section" |
The midpoint of a trace is half way between its source and its receiver, (xs + xg) ÷ 2. On a towed streamer that is straight behind the vessel, each channel stays at about the same distance from the source, so one channel's traces from every shot make a common-offset section.
Try it: sort the traces
A made-up 2D line: 60 shots 25 m apart, a straight streamer of 48 channels 25 m apart, three reflectors. Recorded the SEG way (Lesson 1): a compression is a negative number, so the first reflector starts to the left. Two faults are planted: shot 23 fired weak, and channel 31 is noisy. Sort the same traces three ways and see which one shows each fault.
- Traces
- -
- The weak shot is
- -
- The noisy channel is
- -
The gather demo needs JavaScript; the table above says what each sort is for.
The idea to keepSort the traces so that the fault you are looking for becomes one line: a weak shot is one faint column in a common-offset section, a bad channel is one noisy trace in every shot gather.
9Interesting facts
Exact numbers, rough graphs?
Anscombe built his quartet in 1973 against the view that "numerical calculations are exact, but graphs are rough".
Wikipedia: Anscombe's quartetA chemist's own eyes
The first account of colour blindness was given by the English chemist John Dalton, in 1794.
Wikipedia: Color blindnessCircles of dots
The best-known test for red-green deficiency is named after Shinobu Ishihara, who first published it in 1917: each plate is a circle of coloured dots.
Wikipedia: Ishihara testThe loudest colour
In a rainbow map, yellow is the brightest colour and draws the eye the most - wherever the data puts it.
Crameri, Shephard & Heron (2020)10 before 2
Sorted as text, "10.jpg" comes before "2.jpg". Natural sort order reads the number as a number.
Wikipedia: Natural sort orderLightness has an order
Bertin counted size, value (lightness) and grain as ordered visual variables. Shape is not ordered; hue runs round in a circle.
Wikipedia: Visual variable10Quiz: what stayed?
Ten questions. Pick an answer and it is marked at once, with a line on why. Nothing you answer leaves this page.
-
Answer
The summary can agree while the data does not. Drawn, the sets are a cloud, a curve, a line with an outlier and one far point. Anscombe built them against the view that graphs are rough and numbers exact.
-
Answer
Position along a common scale - dots or bar ends against one axis. Shading and colour saturation come last: colour is for patterns, not for reading values.
-
Answer
A blue mark among grey ones. A target that differs in one feature pops out. A combination of two features must be searched for mark by mark, and more marks take longer.
-
Answer
Diverging, centred on 0 m. The data has a middle that means "on target" and two directions - shallower and deeper. That is the job of two hues meeting at an unsaturated middle.
-
Answer
Qualitative. Source 1, 2 and 3 have no order and no middle: the colour says "which one", so separate hues with no order between them.
-
Answer
Its lightness rises and falls. The eye reads lightness as the data, so the rainbow adds boundaries that are not there, makes the middle look the most important, and prints dark at both ends.
-
Answer
Up to 1 in 12. For women it is about 1 in 200. On a crew of 25 men, at least one of them very probably has it - so never let red against green carry a meaning alone.
-
Answer
Outside its limits, and nothing else. A difference from the median is drawn blue and amber. A reader who learns that red means wrong can then trust every red cell.
-
Answer
G10. Text is compared character by character, and "G1" is the start of "G10". The order runs G1, G10, G11, G12, G2 … - natural sort order puts G2 second.
-
Answer
A common-offset section. There every shot gives one trace side by side, so the weak one stands out against its neighbours. Its own shot gather is fainter all over, with nothing beside it to compare.
11Sources and further reading
Every fact in this lesson comes from one of these. The drawings and the demos' data are the site's own, made up for this page; the colour maps are matplotlib's, and the colour-blind colours are computed with the simulation listed below.
- Anscombe, F. J. (1973). Graphs in statistical analysis. The American Statistician 27(1), 17-21 - the data and its summary, as given in Wikipedia: Anscombe's quartet.
- Wikipedia: Visual search - pop-out, feature and conjunction search, and Treisman and Gelade's feature integration theory (1980).
- Cleveland, W. S. and McGill, R. (1984). Graphical perception: theory, experimentation, and application to the development of graphical methods. Journal of the American Statistical Association 79(387), 531-554 - the ranking, as set out in Cornell University's INFO 3312: Graphical perception.
- matplotlib: Choosing colormaps in Matplotlib - the classes of colour map, lightness, jet in grey, colour vision deficiency.
- ColorBrewer: Learn more: sequential, diverging and qualitative schemes.
- Crameri, F., Shephard, G. E. and Heron, P. J. (2020). The misuse of colour in science communication. Nature Communications 11, 5444.
- van der Walt, S. and Smith, N.: A better default colormap for Matplotlib - how viridis was designed.
- Wikipedia: Color blindness - how many people, and John Dalton.
- Wikipedia: Ishihara test.
- Machado, G. M., Oliveira, M. M. and Fernandes, L. A. F. (2009). A physiologically-based model for simulation of color vision deficiency. IEEE Transactions on Visualization and Computer Graphics 15(6), 1291-1298.
- Wikipedia: Jacques Bertin and Visual variable - Sémiologie graphique (1967), the Bertin matrix, ordered variables.
- Wikipedia: Natural sort order.
- Bianco, E. (2011). G is for Gather. Agile Scientific - the four gathers and what each is good for.
- Stanford Exploration Project: Common-midpoint stacking - the midpoint, and sorting traces into common-midpoint gathers.