Why Perception Matters Before Code
Every chart is a mapping from data values to visual properties. The quality of that mapping determines whether a viewer perceives the truth or a distortion. Cleveland and McGill (1984) conducted controlled experiments asking people to estimate ratios from different visual encodings. Their results, later replicated and extended, produced an accuracy ranking that every visualization practitioner should internalize.
The Encoding Accuracy Hierarchy
From most to least accurate for quantitative variables:
- Position on a common scale (bar chart, scatter plot)
- Position on non-aligned scales (small multiples)
- Length (bar chart with a shifted baseline — still good)
- Angle and slope (pie charts, line slope)
- Area (bubble chart, treemap)
- Volume (3-D bar — avoid)
- Color saturation and hue (heatmap)
This ranking carries a direct design prescription: when your comparison is the primary message, use position. Reserve area and color for secondary variables or for when spatial layout genuinely matters (geographic maps, matrix overviews).
For categorical variables the preferred encodings are: position (grouped bars), color hue (scatter plot categories), shape (scatter plot, use sparingly with ≤6 categories), and — least preferred — size or texture.
Pre-Attentive Processing
Certain visual features are processed by the human visual system in under 200 ms, before conscious attention is directed. These pre-attentive attributes include color hue, color intensity, size, orientation, and motion. A single red dot among fifty blue ones is found instantly; a single bold number in a table is not found instantly because weight is not pre-attentive.
Practical consequence: use a single pre-attentive attribute to highlight the one thing you want the viewer to notice first. Using three different colors plus bold text plus a callout arrow produces visual noise, not emphasis.
Tufte's Data-Ink Ratio
Edward Tufte defines the data-ink ratio as the proportion of a chart's ink devoted to non-redundant data information. The corollary principle: maximize the data-ink ratio by erasing non-data ink and redundant data ink.
Concrete examples of non-data ink to eliminate:
- Default grey background (seaborn's
darkgridstyle adds gridlines that compete with data) - 3-D effects, drop shadows, gradient fills
- Redundant axis labels when the title already states the unit
- Legends that merely repeat the axis label
Tufte's ideal is not a spartan chart with no context — it is a chart where every pixel earns its presence.
Chart Selection Guide
The right chart type follows from three questions: What is the data type? What is the comparison type? How many variables?
Distribution of one quantitative variable: histogram, KDE plot, violin plot. Use a histogram when bin counts matter; KDE when the shape of the distribution is the message; violin when comparing distributions across categories.
Relationship between two quantitative variables: scatter plot. Add a regression line when trend is the message. Use hexbin or 2-D KDE when point density obscures the scatter.
Comparison of a quantitative variable across categories: bar chart (avoid pie charts for more than ~4 categories). If you need to show variance, use a box plot or violin. If individual points matter, use a strip plot or beeswarm.
Change over time: line chart. Use bars only when the time series is sparse (fewer than ~8 points) or when discrete periods matter more than continuity.
Part-to-whole: stacked bar (for 2-4 parts), treemap (for hierarchical parts). Avoid pie charts when slices are similar in size — human angle judgment is weak.
Geographic distribution: choropleth for aggregated rates; dot map for individual events. Never encode count with a choropleth of unequal areas without normalizing to a rate.
Common Anti-Patterns
Truncated y-axis. Starting a bar chart's y-axis at a non-zero value exaggerates differences. Rule: bar charts must start at zero because bars encode length from a baseline. Line charts may use a zoomed range when the absolute baseline is irrelevant and the trend is the message — but you must say so explicitly.
Dual y-axes. Two different scales on the same axes create spurious correlation or mask it. The perceived relationship between the two series changes arbitrarily depending on scale choice. Use small multiples instead.
Rainbow color maps. Jet and similar rainbow gradients introduce perceptual artifacts — false boundaries appear where the hue shifts rapidly. For sequential data use perceptually uniform maps: viridis, plasma, cividis. For diverging data use RdBu or coolwarm with a meaningful midpoint.
Unlabeled axes and missing units. A chart without axis labels or units cannot be verified or reproduced. This is not a style choice; it is a factual omission.