04

Chapter 4 · Design

Visual Best Practices

Some visual channels are read accurately by the human eye and some are not. The ranking is known, it is not a matter of taste, and designing well means picking the highest-ranked channel your data allows.

1Four measurement scales

Chapter 1 classified data by what it holds. This classifies it by what arithmetic is legal, which is the distinction that stops you drawing false conclusions.

Fig 4.1Which operations each scale allows
The interval trap is the one that catches people. Interval scales have no true zero, so differences are meaningful but proportions are not. You can say Hyderabad is 25 degrees warmer than Shimla. You cannot say it is twice as hot. Identify the scale before you compute, otherwise you apply arithmetic the data does not support and produce conclusions that look rigorous and are false.
Fig 4.2Why 50 °C is not twice as hot as 25 °C
same two temperatures, measured in

The ratio changes when you change the unit, which is exactly what proves the ratio was never meaningful. In Kelvin, which does have a true zero, the ratio stays put whatever else you do. A true zero is what makes proportional statements valid, and it is the only difference between interval and ratio.

How the eye decodes a graph

Cleveland's three operations, performed automatically every time somebody looks at a chart.

1

Detection

Find the geometric object carrying the quantity. Bar length is the quantity. Pie area is the share.

2

Assembly

Group the marks and find structure, for example following an ordered set of bars as a trend.

3

Estimation

Judge magnitude and difference. "This is roughly five times that."

Fig 4.3Sorting, and what it does to assembly

Ordering a chart logically speeds up assembly enormously, which is why sorting bars by value is such a cheap improvement. Most weak charts fail at estimation while passing detection, so when you design, check the reader can perform all three.

The encoding effectiveness ranking

This is the core of Chapter 4. Visual channels ranked by how accurately people read them.

#EncodingDiscriminateRankEstimate
1Position on a common aligned scaleYesYesYes
2Position on identical but non-aligned scalesYesYesYes
3LengthYesYesYes
4Angle / slopeYesYesPartly, needs a derived metric
5Volume / density / saturationYesPartlyWeakly
6ColourYesBarelyNo
  1. Colour separates categories and stops there. You can say which is highest and lowest, but never by how much.
  2. Volume beats colour. Bubble sizes rank reasonably, but comparing circle areas by eye is imprecise, so you end up saying "slightly more" instead of giving a number.
  3. Angle shows direction of change well. For rate of change, plot the rate itself rather than asking the audience to judge slopes.
  4. Length does all three, which is why the humble bar chart is so hard to beat.
  5. Position on a common scale is the most accurate channel available, because the eye measures distance against one shared axis directly.

Test yourself on the ranking

Fig 4.4Two marks, one question: how many times bigger is B than A?
channel

Run the same guess down the ranking and watch your own error grow. On position and length most people land within a few percent. On area the error typically doubles, and on colour saturation there is nothing to estimate with at all. That growing error is the ranking, measured on yourself.

The practical limit on colour

Fig 4.5Discrimination failing past six colours

Avoid more than six colours in one chart. Past that, discrimination itself starts to fail, and matching a slice to its legend entry becomes the reader's main activity. The fix is never a seventh hue: it is folding the small categories into "other", or splitting the chart.

Expressiveness and effectiveness

Test 1

Expressiveness

Does it show all the facts in the data, and nothing the data does not contain?

Test 2

Effectiveness

Is it perceived as easily as it possibly could be? The working definition: information is presented effectively if you cannot improve it further.

A chart can be fully expressive and still ineffective. A saturated colour map contains every value and lets you estimate none of them, which is exactly the case the ranking predicts.

Structured data: choosing the chart

AnalysisPurposeCharts
Univariate, countsOne variableBar chart, big number, pie or donut
Univariate, distributionSpread and outliersHistogram, boxplot
Multivariate, comparisonGroups against each otherStacked bar, box chart
Multivariate, relationshipsDo variables move togetherScatter, heat map, parallel coordinates
Multivariate, trendsChange over timeLine chart, dual-axis chart

Big number is the one addition worth noting: a single figure set large is a legitimate chart type when one number is the finding. Boxplot construction is repeated here, and correlation against causation is restated, because the course returns to both repeatedly.

Unstructured data: the pre-processing pipeline

Structured data is a matrix with defined variables. Text has no structure, so it must be converted into something computable before any chart is possible.

Fig 4.6One review, taken through all seven steps
step

Stemming against lemmatisation is the pair worth knowing. Stemming chops characters and sometimes destroys meaning, so "happiness" and "happily" reduce to a stem that means nothing. Lemmatisation resolves to a real root word and does not, so "increased", "increasing" and "increasingly" all give "increase".

Charts for text

Fig 4.7Why a word cloud needs a frequency bar chart beside it
word cloud · size carries frequency
frequency bar chart · length carries frequency
The cloud shows which word is largest and supports no estimation, exactly as the ranking predicts for size. Try to say from the cloud alone how much more often "delivery" appears than "packaging". The bar chart is the cloud's necessary companion, because length does the estimating the cloud cannot.
ChartShows
Word cloudFrequency as font size. The fastest way to see dominant terms
Frequency bar chartThe same counts, but readable as numbers
Word treeBranches from a root node to show which words follow which, revealing relationships between entities
Sentiment scoreTone of a passage: positive, neutral or negative
Joint plotPolarity against subjectivity, with both distributions on the axes

Polarity and subjectivity

Polarity

−1 to +1

How negative or positive the text is.

Subjectivity

0 to 1

How much opinion and emotion it carries, against fact. "I feel hungry" is subjective, "I earn a salary" is objective.

Fig 4.8A joint plot, and what averaging destroys

Aggregate sentiment can cancel out. A body of text with strongly positive and strongly negative sections averages to neutral, which hides both. Always segment before averaging sentiment, otherwise the summary destroys the finding.

Analysing conversations

Five questions define any conversation, and each maps to a visual: when it happened, who was involved, from whom to whom, how dense the network is, and what was said.

Fig 4.9Timing and network, from the same message log

Timing is a simple count of messages on a timeline, and a sudden spike in volume is a finding on its own, before anybody reads a word. Density asks whether it is two people talking or one person addressing many, and content is where topic modelling comes in.

Finding topics

TechniqueWhat it does
Word embeddingGroups words used in similar linguistic contexts. The classic relation is king to man as queen is to woman
Topic modellingUnsupervised learning, using LDA (latent Dirichlet allocation) or LSA (latent semantic analysis), that splits documents into a chosen number of topics
t-SNE clusteringt-distributed stochastic neighbour embedding. Reduces high-dimensional text to a plottable space
Fig 4.10The topic model output: bubbles, and the words inside one
Click any bubble. Distance between bubbles is dissimilarity between topics, so close bubbles are related and distant ones are unrelated, and bubble size is how much of the corpus that topic accounts for. Alongside it sits the word frequency within the selected topic, because the bubble alone never tells you what the topic is about.

Key points

  1. Four measurement scales with the operations each permits.
  2. Why 50 °C is not twice as hot as 25 °C, and what a true zero has to do with it.
  3. Cleveland's three visual operations: detection, assembly, estimation.
  4. The encoding effectiveness ranking, in order, from position on a common scale down to colour.
  5. The three audience functions: discriminate, rank, estimate, and which encodings support which.
  6. Why colour cannot support estimation, and the six-colour limit.
  7. When to plot rate of change instead of asking the audience to judge slopes.
  8. Expressiveness against effectiveness, and the "cannot improve it further" test.
  9. The seven-step text pre-processing pipeline in order.
  10. Stemming against lemmatisation, with an example where stemming fails.
  11. Why a word cloud needs a frequency bar chart beside it.
  12. Polarity and subjectivity, their ranges, and why aggregate sentiment can mislead.
  13. The five aspects of a conversation.
  14. Word embedding, topic modelling with LDA or LSA, and t-SNE, and what each contributes.