Skip to main content
Data Visualization
CHAPTER 24 Beginner

Visualization Best Practices

Updated: May 18, 2026
5 min read

# CHAPTER 24

Visualization Best Practices

1. Chapter Introduction

Every best practice in this chapter comes from cognitive science and professional design research. Following these rules is what separates student charts from Economist-quality publications.

2. The Data-Ink Ratio

text
123456789101112131415161718192021
Edward Tufte's Data-Ink Ratio:
  Data-Ink Ratio = Data-Ink / Total Ink

  Maximize = remove everything that doesn't encode data

REMOVE:
  ❌ Gridlines that don't aid reading
  ❌ Heavy borders around the chart
  ❌ 3D effects (always)
  ❌ Unnecessary tick marks
  ❌ Background colors or gradients
  ❌ Decorative elements ("chart junk")
  ❌ Redundant legends (label directly)

KEEP:
  ✅ Data series (bars, lines, points)
  ✅ Essential gridlines (y-axis only for bar charts)
  ✅ Axis labels with units
  ✅ Clear title
  ✅ Reference lines (targets, averages)
  ✅ Annotations for key insights

3. Before/After: Applying Best Practices

python
123456789101112131415161718192021222324252627282930313233343536373839
import matplotlib.pyplot as plt
import numpy as np

products = ['Laptop', 'Phone', 'Monitor', 'Desk', 'Chair']
sales    = [850, 1240, 430, 620, 380]

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))

# BAD CHART — common mistakes
ax1.bar(products, sales, color=['red','green','blue','orange','purple'], width=0.9)
ax1.set_title('Product Sales', fontsize=9)
ax1.set_xlabel('Product Name')
ax1.set_ylabel('Units')
ax1.grid(True)
for spine in ax1.spines.values():
    spine.set_linewidth(2)
ax1.set_facecolor('#EEEEEE')  # Grey background
ax1.tick_params(axis='both', length=5)
ax1.legend(['Sales'], loc='upper right')
ax1.set_title('❌ POOR: Chart junk, wrong colors, full grid', fontsize=10)

# GOOD CHART — best practices
bars = ax2.barh(products, sales, color=['#1565C0' if s == max(sales) else '#90CAF9' for s in sales],
                 height=0.6, edgecolor='white')
for bar, val in zip(bars, sales):
    ax2.text(val + 5, bar.get_y() + bar.get_height()/2,
              f'{val:,} units', va='center', fontsize=10)
ax2.set_title('✅ GOOD: Clean, sorted, direct labels', fontsize=10, fontweight='bold')
ax2.set_xlabel('Units Sold')
ax2.spines['top'].set_visible(False)
ax2.spines['right'].set_visible(False)
ax2.spines['left'].set_visible(False)
ax2.set_xticks([])   # Remove x-axis since values are labeled
ax2.grid(False)      # No gridlines needed with direct labels

plt.suptitle('Best Practices: Before vs After', fontsize=13, fontweight='bold')
plt.tight_layout()
plt.savefig('best_practices.png', dpi=150)
plt.show()

4. The 10 Commandments of Data Visualization

text
12345678910
1. START BARS AT ZERO — bar length encodes value
2. USE POSITION > LENGTH > COLOR > ANGLE > SIZE for accuracy
3. SORT FOR INSIGHT — sorted bars reveal ranking immediately
4. LIMIT COLORS — max 7-8 categorical colors; use grey for context
5. LABEL DIRECTLY — data labels beat legends for small datasets
6. REMOVE CHART JUNK — eliminate decorative elements
7. ONE MESSAGE PER CHART — design for one clear takeaway
8. MOBILE-FRIENDLY — fonts ≥ 11px, enough contrast
9. CITE YOUR DATA — always include source and date
10. TELL A STORY — "what, so what, now what" structure

5. Common Mistakes

  • Rainbow colors for comparison: Using a different color per bar implies categories are different types. If bars are same category (one metric), use same color with highlight for maximum.
  • Not sorting bars: Unsorted bars force viewers to rank visually — always sort descending for ranking insights (except time-ordered data like months).

6. MCQs

Question 1

Data-ink ratio is maximized by?

Question 2

"Chart junk" (Tufte) refers to?

Question 3

Most accurate visual encoding for quantity?

Question 4

Direct data labels instead of legends?

Question 5

Bar charts MUST start Y-axis at?

Question 6

Maximum categorical colors per chart?

Question 7

Sorted bar charts reveal?

Question 8

"One message per chart" means?

Question 9

3D charts are problematic because?

Question 10

Grey bars behind highlighted bars?

7. Interview Questions

  • Q: What is Edward Tufte's data-ink ratio and why does it matter?
  • Q: What are three common visualization mistakes and how do you fix them?

8. Summary

Best practices: zero-based bars, position over angle, sort for insight, limit colors (7-8 max), remove chart junk, direct labels over legends, one message per chart, cite sources. The data-ink ratio principle: every element must encode data or aid reading. If it doesn't, remove it.

9. Next Chapter Recommendation

In Chapter 25: Common Visualization Mistakes, we analyze real-world bad charts and learn to identify and fix the most common visualization errors.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·