Data Visualization
Principles and best practices for effective data visualization.
Core Principles
Tufte's Foundations
Data-Ink Ratio: Maximize ink used for actual data
- Remove unnecessary gridlines, borders, backgrounds
- Eliminate 3D effects, shadows, decorative elements
- Every visual element must justify its existence
Lie Factor: Graphical representation must match data
- Lie Factor = Size of Effect in Graphic / Size of Effect in Data
- Ideal = 1. Substantial distortion when >1.05 or <0.95
- Avoid: non-zero baselines, inconsistent scales, 3D distortion
Chart Junk: Remove non-data ink and redundant data-ink
Graphical Integrity
| Practice |
Rule |
| Bar charts |
Must start at zero |
| Proportions |
Size encodements reflect actual ratios |
| 3D effects |
Never use—distorts perception |
| Pie charts |
Maximum 3-4 slices |
Visual Perception
Gestalt Principles
| Principle |
Application |
| Proximity |
Cluster related data; space different categories |
| Similarity |
Consistent color/shape for categories |
| Continuity |
Connected line charts for trends |
| Closure |
Complete shapes, avoid unnecessary borders |
| Figure/Ground |
Data stands out against background |
| Connection |
Lines/links show relationships |
Preattentive Attributes
Processed in <200ms before conscious attention:
Hierarchy: Position > Color > Size > Shape > Orientation
| Attribute |
Use Case |
| Position (spatial) |
Ranking, trends |
| Color (hue) |
Categorical distinction |
| Size |
Quantitative comparison |
| Shape |
Category distinction |
| Intensity |
Highlighting differences |
Color
Palette Types
Sequential: Ordered data (low → high), single hue light to dark
Diverging: Data with meaningful midpoint, two hues meeting at neutral
Categorical: Nominal data, distinct equally-spaced hues (max 6-8)
Color-Blind Safe Palettes
~8% of men and 0.5% of women have color vision deficiency. Design for them by default.
Okabe-Ito Palette (recommended default):
- Black
#000000, Orange #E69F00, Sky Blue #56B4E9
- Bluish Green
#009E73, Yellow #F0E442, Blue #0072B2
- Vermillion
#D55E00, Reddish Purple #CC79A7
Other tested palettes: Viridis, Cividis, Paul Tol, ColorBrewer (colorblind filter)
Color Blindness Types
| Type |
Prevalence |
Confusion |
| Deuteranomaly |
5% of men |
Red-green (most common) |
| Protanopia |
1% of men |
Red-green |
| Deuteranopia |
1.3% of men |
Red-green |
| Tritanopia |
0.0001% |
Blue-yellow (rare) |
| Achromatopsia |
0.003% |
No color (greyscale) |
Cultural Considerations
| Color |
Western |
China |
Other |
| Red |
Danger |
Good luck |
Death (some African) |
| White |
Purity |
Death |
|
| Green |
Environment |
Infidelity |
|
Accessibility
Fundamental Rule
Never use color alone to encode data. Always combine with at least one other channel:
- Color + pattern/texture (bar charts)
- Color + line style: solid, dashed, dotted (line charts)
- Color + shape (scatter plots)
- Color + direct labels (all charts)
Contrast Requirements (WCAG)
| Element |
AA (minimum) |
AAA (enhanced) |
| Body text |
4.5:1 |
7:1 |
| Large text (18pt+) |
3:1 |
4.5:1 |
| Non-text (lines, bars, icons) |
3:1 |
— |
| Focus indicators |
3:1 |
3:1 + 2px space |
Low Vision Design
~253 million people globally have visual impairment.
Typography in charts:
- Minimum 12px for labels (14px preferred)
- Sans-serif fonts for readability
- Line height ≥1.5×
- High contrast text (4.5:1 minimum)
Layout:
- Support browser zoom to 200% without content loss
- No horizontal scrolling at zoomed levels
- Direct data labeling reduces magnification needs
- Avoid cluttered, dense layouts
Dark mode:
- Avoid pure white (#fff) on pure black (#000) — causes halation
- Use slightly heavier font weights on dark backgrounds
- Maintain all contrast ratios
Screen Reader Accessibility
Alt text for charts (follow the four-level model by Lundgard & Satyanarayan, 2021):
- What: Chart type and data ("Bar chart showing 2024 sales by region")
- How: Encoding method ("Bars represent revenue in USD")
- Readout: Key values ("North America leads at $450K")
- Insight: Patterns/trends ("45% year-over-year growth")
SVG accessibility:
<svg role="img" aria-labelledby="title desc">
<title id="title">2024 Sales by Region</title>
<desc id="desc">Bar chart. North America leads with 45% of revenue.</desc>
</svg>
Always provide: data table alternative or detailed description for complex charts.
Multi-Modal Access
Beyond visual, consider:
- Sonification: Map data values to pitch/rhythm (Highcharts Sonification Studio, TwoTone)
- Tactile graphics: Raised-surface charts for blind users (swell-touch paper, 3D print)
- Haptic feedback: Vibration intensity proportional to data values
- MAIDR: Multi-Access Interactive Data Representation (text + audio + tactile)
Accessibility Legislation
| Jurisdiction |
Law/Standard |
Requirement |
| US |
Section 508, ADA |
WCAG 2.0/2.1 AA (federal); courts use WCAG for ADA |
| EU |
European Accessibility Act (2025), EN 301 549 |
WCAG 2.1 AA for public + private sectors |
| UK |
Equality Act 2010, PSBAR 2018 |
WCAG 2.1 AA for public sector |
| Japan |
JIS X 8341-3:2016 |
Aligned with WCAG, AA recommended |
| Australia |
Disability Discrimination Act 1992 |
WCAG 2.1 AA benchmark |
| Canada |
Accessible Canada Act, AODA (Ontario) |
WCAG 2.0 AA minimum, moving to 2.1 |
| Singapore |
Digital Service Standards |
WCAG 2.1 AA for government |
| China |
GB/T 37668-2019 |
Aligned with WCAG 2.0 |
| South Korea |
KWCAG 2.1 |
Aligned with WCAG 2.1 |
Accessibility Testing Checklist
Chart Selection
Data type:
├─ Categorical comparison → Bar chart
├─ Part-to-whole → Treemap/stacked bar (avoid pie >4 slices)
├─ Time series → Line chart
├─ Distribution → Histogram, box plot, violin
├─ Correlation → Scatter plot
├─ Geographic → Choropleth, proportional symbol
└─ Network/flow → Network graph, Sankey
Common Mistakes
Avoid
- Truncated Y-axis in bar charts
- Dual Y-axes (false correlations)
4 pie chart slices
- 3D charts
- Rainbow palettes without meaning
- Over-plotting (too many points)
- Color-only encoding (accessibility failure)
- Insufficient contrast on chart elements
Fixes
- Clutter → Small multiples, sparklines
- No context → Add baseline, benchmarks
- Hard to compare → Consistent scales, aligned axes
- Data overload → Filter, aggregate, progressive disclosure
- Inaccessible → Redundant encoding, alt text, data tables
Domain Guidance
Financial
- Candlestick charts for prices
- Treemaps for portfolio allocation
- Log vs linear scale for long timeframes
- Annotate key events (earnings, mergers)
Security/SOC
- Heatmaps for activity over time
- Network graphs for connection analysis
- Sankey for traffic flow
- Red/amber/green severity (with icons for color-blind users)
- Dark theme preferred (reduce eye strain)
Scientific
- Vector graphics (SVG, PDF)
- Field-specific conventions
- Follow Nature 2025 checklist: clarity, accessibility
- 300+ DPI, clear labeling
- Color-blind safe palettes mandatory for publications
Tools
| Use Case |
Tool |
| Custom web viz |
D3.js, Plotly, Olli (accessible) |
| BI dashboards |
Tableau, Power BI, Apache ECharts |
| Static reports |
Matplotlib, Seaborn, ggplot2 |
| Rapid prototyping |
Flourish, Google Data Studio |
| AI/ML integration |
Python (Matplotlib, Plotly, Altair) |
Accessibility Tools
| Purpose |
Tool |
| Color blind simulation |
Coblis, ColorOracle, Chrome "Let Me Color" |
| Contrast checking |
WebAIM Contrast Checker, axe DevTools |
| Screen reader testing |
NVDA (free), JAWS, VoiceOver |
| Accessibility audit |
WAVE, Lighthouse, Accessibility Insights |
| Accessible charts |
Olli (MIT), Highcharts Sonification |
| Color palette design |
ColorBrewer, Paul Tol, Accessible Colors |
Quick Reference
- Start with grayscale — add color only to encode data
- Redundant encoding — color + pattern/shape/label always
- Okabe-Ito palette — default color-blind safe choice
- 4.5:1 / 3:1 — text contrast / non-text contrast minimums
- Small multiples — same chart across subsets solves clutter
- Tufte's test — can you remove this element and still understand?
- Alt text + data table — provide text alternatives for every chart
- Test accessibility — simulator + screen reader + grayscale
Resources
- Tufte's 4 books (foundational)
- Wilke, Fundamentals of Data Visualization (2019)
- Lundgard & Satyanarayan, "Accessible Visualization via Natural Language Descriptions" (2021)
- Hajas et al., "Rich Screen Reader Experiences" (2022, MIT)
- Nature 2025 scientific visualization checklist
- W3C WAI: w3.org/WAI
- ColorBrewer: colorbrewer2.org
- WebAIM: webaim.org
- DIAGRAM Center: diagramcenter.org
1---2name: data-visualization3description: Data visualization and information design best practices. Use when creating charts, dashboards, graphs, or any visual representation of data.4---56# Data Visualization78Principles and best practices for effective data visualization.910## Core Principles1112### Tufte's Foundations1314**Data-Ink Ratio**: Maximize ink used for actual data15- Remove unnecessary gridlines, borders, backgrounds16- Eliminate 3D effects, shadows, decorative elements17- Every visual element must justify its existence1819**Lie Factor**: Graphical representation must match data20- Lie Factor = Size of Effect in Graphic / Size of Effect in Data21- Ideal = 1. Substantial distortion when >1.05 or <0.9522- Avoid: non-zero baselines, inconsistent scales, 3D distortion2324**Chart Junk**: Remove non-data ink and redundant data-ink2526### Graphical Integrity2728| Practice | Rule |29|----------|------|30| Bar charts | Must start at zero |31| Proportions | Size encodements reflect actual ratios |32| 3D effects | Never use—distorts perception |33| Pie charts | Maximum 3-4 slices |3435## Visual Perception3637### Gestalt Principles3839| Principle | Application |40|-----------|-------------|41| **Proximity** | Cluster related data; space different categories |42| **Similarity** | Consistent color/shape for categories |43| **Continuity** | Connected line charts for trends |44| **Closure** | Complete shapes, avoid unnecessary borders |45| **Figure/Ground** | Data stands out against background |46| **Connection** | Lines/links show relationships |4748### Preattentive Attributes4950Processed in <200ms before conscious attention:5152**Hierarchy:** Position > Color > Size > Shape > Orientation5354| Attribute | Use Case |55|-----------|----------|56| Position (spatial) | Ranking, trends |57| Color (hue) | Categorical distinction |58| Size | Quantitative comparison |59| Shape | Category distinction |60| Intensity | Highlighting differences |6162## Color6364### Palette Types6566**Sequential**: Ordered data (low → high), single hue light to dark 67**Diverging**: Data with meaningful midpoint, two hues meeting at neutral 68**Categorical**: Nominal data, distinct equally-spaced hues (max 6-8)6970### Color-Blind Safe Palettes7172~8% of men and 0.5% of women have color vision deficiency. Design for them by default.7374**Okabe-Ito Palette** (recommended default):75- Black `#000000`, Orange `#E69F00`, Sky Blue `#56B4E9`76- Bluish Green `#009E73`, Yellow `#F0E442`, Blue `#0072B2`77- Vermillion `#D55E00`, Reddish Purple `#CC79A7`7879**Other tested palettes**: Viridis, Cividis, Paul Tol, ColorBrewer (colorblind filter)8081### Color Blindness Types8283| Type | Prevalence | Confusion |84|------|-----------|-----------|85| Deuteranomaly | 5% of men | Red-green (most common) |86| Protanopia | 1% of men | Red-green |87| Deuteranopia | 1.3% of men | Red-green |88| Tritanopia | 0.0001% | Blue-yellow (rare) |89| Achromatopsia | 0.003% | No color (greyscale) |9091### Cultural Considerations9293| Color | Western | China | Other |94|-------|---------|-------|-------|95| Red | Danger | Good luck | Death (some African) |96| White | Purity | Death | |97| Green | Environment | Infidelity | |9899## Accessibility100101### Fundamental Rule102103**Never use color alone to encode data.** Always combine with at least one other channel:104- Color + pattern/texture (bar charts)105- Color + line style: solid, dashed, dotted (line charts)106- Color + shape (scatter plots)107- Color + direct labels (all charts)108109### Contrast Requirements (WCAG)110111| Element | AA (minimum) | AAA (enhanced) |112|---------|-------------|----------------|113| Body text | 4.5:1 | 7:1 |114| Large text (18pt+) | 3:1 | 4.5:1 |115| Non-text (lines, bars, icons) | 3:1 | — |116| Focus indicators | 3:1 | 3:1 + 2px space |117118### Low Vision Design119120~253 million people globally have visual impairment.121122**Typography in charts:**123- Minimum 12px for labels (14px preferred)124- Sans-serif fonts for readability125- Line height ≥1.5×126- High contrast text (4.5:1 minimum)127128**Layout:**129- Support browser zoom to 200% without content loss130- No horizontal scrolling at zoomed levels131- Direct data labeling reduces magnification needs132- Avoid cluttered, dense layouts133134**Dark mode:**135- Avoid pure white (#fff) on pure black (#000) — causes halation136- Use slightly heavier font weights on dark backgrounds137- Maintain all contrast ratios138139### Screen Reader Accessibility140141**Alt text for charts** (follow the four-level model by Lundgard & Satyanarayan, 2021):1421. **What**: Chart type and data ("Bar chart showing 2024 sales by region")1432. **How**: Encoding method ("Bars represent revenue in USD")1443. **Readout**: Key values ("North America leads at $450K")1454. **Insight**: Patterns/trends ("45% year-over-year growth")146147**SVG accessibility:**148```html149<svg role="img" aria-labelledby="title desc">150 <title id="title">2024 Sales by Region</title>151 <desc id="desc">Bar chart. North America leads with 45% of revenue.</desc>152</svg>153```154155**Always provide**: data table alternative or detailed description for complex charts.156157### Multi-Modal Access158159Beyond visual, consider:160- **Sonification**: Map data values to pitch/rhythm (Highcharts Sonification Studio, TwoTone)161- **Tactile graphics**: Raised-surface charts for blind users (swell-touch paper, 3D print)162- **Haptic feedback**: Vibration intensity proportional to data values163- **MAIDR**: Multi-Access Interactive Data Representation (text + audio + tactile)164165### Accessibility Legislation166167| Jurisdiction | Law/Standard | Requirement |168|-------------|-------------|-------------|169| **US** | Section 508, ADA | WCAG 2.0/2.1 AA (federal); courts use WCAG for ADA |170| **EU** | European Accessibility Act (2025), EN 301 549 | WCAG 2.1 AA for public + private sectors |171| **UK** | Equality Act 2010, PSBAR 2018 | WCAG 2.1 AA for public sector |172| **Japan** | JIS X 8341-3:2016 | Aligned with WCAG, AA recommended |173| **Australia** | Disability Discrimination Act 1992 | WCAG 2.1 AA benchmark |174| **Canada** | Accessible Canada Act, AODA (Ontario) | WCAG 2.0 AA minimum, moving to 2.1 |175| **Singapore** | Digital Service Standards | WCAG 2.1 AA for government |176| **China** | GB/T 37668-2019 | Aligned with WCAG 2.0 |177| **South Korea** | KWCAG 2.1 | Aligned with WCAG 2.1 |178179### Accessibility Testing Checklist180181- [ ] Color not sole encoding method (WCAG 1.4.1)182- [ ] Text contrast ≥4.5:1 (WCAG 1.4.3)183- [ ] Non-text contrast ≥3:1 (WCAG 1.4.11)184- [ ] Supports 200% zoom (WCAG 1.4.4)185- [ ] Text spacing adjustable (WCAG 1.4.12)186- [ ] Alt text or data table provided (WCAG 1.1.1)187- [ ] Keyboard navigable (WCAG 2.1.1)188- [ ] Test with color blindness simulator (Coblis, ColorOracle)189- [ ] Test with screen reader (NVDA, VoiceOver)190- [ ] Grayscale test: still understandable?191192## Chart Selection193194```195Data type:196├─ Categorical comparison → Bar chart197├─ Part-to-whole → Treemap/stacked bar (avoid pie >4 slices)198├─ Time series → Line chart199├─ Distribution → Histogram, box plot, violin200├─ Correlation → Scatter plot201├─ Geographic → Choropleth, proportional symbol202└─ Network/flow → Network graph, Sankey203```204205## Common Mistakes206207### Avoid208- Truncated Y-axis in bar charts209- Dual Y-axes (false correlations)210- >4 pie chart slices211- 3D charts212- Rainbow palettes without meaning213- Over-plotting (too many points)214- Color-only encoding (accessibility failure)215- Insufficient contrast on chart elements216217### Fixes218- **Clutter** → Small multiples, sparklines219- **No context** → Add baseline, benchmarks220- **Hard to compare** → Consistent scales, aligned axes221- **Data overload** → Filter, aggregate, progressive disclosure222- **Inaccessible** → Redundant encoding, alt text, data tables223224## Domain Guidance225226### Financial227- Candlestick charts for prices228- Treemaps for portfolio allocation229- Log vs linear scale for long timeframes230- Annotate key events (earnings, mergers)231232### Security/SOC233- Heatmaps for activity over time234- Network graphs for connection analysis235- Sankey for traffic flow236- Red/amber/green severity (**with icons** for color-blind users)237- Dark theme preferred (reduce eye strain)238239### Scientific240- Vector graphics (SVG, PDF)241- Field-specific conventions242- Follow Nature 2025 checklist: clarity, accessibility243- 300+ DPI, clear labeling244- Color-blind safe palettes mandatory for publications245246## Tools247248| Use Case | Tool |249|----------|------|250| Custom web viz | D3.js, Plotly, Olli (accessible) |251| BI dashboards | Tableau, Power BI, Apache ECharts |252| Static reports | Matplotlib, Seaborn, ggplot2 |253| Rapid prototyping | Flourish, Google Data Studio |254| AI/ML integration | Python (Matplotlib, Plotly, Altair) |255256### Accessibility Tools257258| Purpose | Tool |259|---------|------|260| Color blind simulation | Coblis, ColorOracle, Chrome "Let Me Color" |261| Contrast checking | WebAIM Contrast Checker, axe DevTools |262| Screen reader testing | NVDA (free), JAWS, VoiceOver |263| Accessibility audit | WAVE, Lighthouse, Accessibility Insights |264| Accessible charts | Olli (MIT), Highcharts Sonification |265| Color palette design | ColorBrewer, Paul Tol, Accessible Colors |266267## Quick Reference2682691. **Start with grayscale** — add color only to encode data2702. **Redundant encoding** — color + pattern/shape/label always2713. **Okabe-Ito palette** — default color-blind safe choice2724. **4.5:1 / 3:1** — text contrast / non-text contrast minimums2735. **Small multiples** — same chart across subsets solves clutter2746. **Tufte's test** — can you remove this element and still understand?2757. **Alt text + data table** — provide text alternatives for every chart2768. **Test accessibility** — simulator + screen reader + grayscale277278## Resources279280- Tufte's 4 books (foundational)281- Wilke, *Fundamentals of Data Visualization* (2019)282- Lundgard & Satyanarayan, "Accessible Visualization via Natural Language Descriptions" (2021)283- Hajas et al., "Rich Screen Reader Experiences" (2022, MIT)284- Nature 2025 scientific visualization checklist285- W3C WAI: w3.org/WAI286- ColorBrewer: colorbrewer2.org287- WebAIM: webaim.org288- DIAGRAM Center: diagramcenter.org