Skip to main content
Data Visualization
CHAPTER 03 Beginner

Understanding Data and Visualization Principles

Updated: May 18, 2026
5 min read

# CHAPTER 3

Understanding Data and Visualization Principles

1. Chapter Introduction

Knowing WHICH chart to use is more important than knowing HOW to code it. This chapter covers the framework every professional uses: data type classification, visual encoding theory, and the psychology behind why certain visuals work better than others.

2. Data Types and Their Visualizations

text
12345678910111213141516171819202122232425262728
DATA TYPE CLASSIFICATION:

Quantitative (Numeric):
  Continuous: Can take any value — Height, Revenue, Temperature
  Discrete:   Whole numbers only — Employees, Clicks, Orders

Categorical (Non-numeric):
  Nominal:  No order — City names, Colors, Product types
  Ordinal:  Has meaningful order — Ratings (1-5), Education level

Temporal (Time-based):
  Dates, timestamps, durations

Geographic:
  Countries, coordinates, regions

+─────────────────+────────────────────────────────────────────+
│ Data Type       │ Best Chart                                 │
+─────────────────+────────────────────────────────────────────+
│ Continuous qty  │ Histogram, KDE, Box plot, Line chart       │
│ Discrete qty    │ Bar chart, Dot plot                        │
│ Nominal cat     │ Bar chart, Treemap, Word cloud             │
│ Ordinal cat     │ Bar chart (ordered), Diverging bar         │
│ Two quantities  │ Scatter plot, Bubble chart, Heatmap        │
│ Time series     │ Line chart, Area chart, Candlestick        │
│ Part-of-whole   │ Pie (≤5), Donut, Treemap, Waffle           │
│ Geographic      │ Choropleth, Dot map, Bubble map            │
+─────────────────+────────────────────────────────────────────+

3. Pre-Attentive Attributes — Visual Encoding

text
1234567891011121314151617
Pre-attentive attributes are processed by the brain in < 250ms
(before conscious attention):

✅ Most Powerful Encodings:
  1. Position      → Most accurate for quantitative comparison
  2. Length        → Second most accurate (bar charts)
  3. Color hue     → Best for categorical distinction
  4. Color value   → Best for showing magnitude (dark = more)

⚠️ Less Accurate Encodings (use with caution):
  5. Size/Area     → Hard to compare precisely (bubble charts)
  6. Angle         → Why pie charts are hard to read accurately
  7. Shape         → Good for categories, bad for quantity
  8. Texture       → Last resort only

Rule: Use POSITION and LENGTH for quantitative data.
      Use COLOR HUE for categorical distinction.

4. Chart Selection Decision Tree

text
1234567891011121314151617181920212223
What do you want to show?
│
├── HOW THINGS CHANGE OVER TIME?
│   └── Line chart (continuous) or Bar chart (discrete periods)
│
├── HOW THINGS COMPARE?
│   ├── Few items (≤7) → Bar chart (horizontal for long labels)
│   └── Many items    → Sorted bar, Dot plot
│
├── HOW THINGS DISTRIBUTE?
│   ├── Single variable → Histogram or Box plot
│   └── By category    → Violin or grouped Box plot
│
├── HOW THINGS RELATE?
│   ├── Two variables  → Scatter plot
│   └── Many variables → Correlation heatmap or Pair plot
│
├── PART-OF-WHOLE?
│   ├── ≤5 categories  → Pie or Donut chart
│   └── Many categories→ Treemap or Stacked bar
│
└── WHERE THINGS ARE?
    └── Map (Choropleth for values, Dot for locations)

5. Color Theory for Visualization

python
12345678910111213141516171819202122232425262728293031
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np

fig, axes = plt.subplots(1, 3, figsize=(15, 4))

# Sequential palette — for ordered/magnitude data
cmap_seq = plt.cm.Blues
vals = np.linspace(0, 1, 8)
for i, v in enumerate(vals):
    axes[0].bar(i, 1, color=cmap_seq(v), edgecolor=&#039;none')
axes[0].set_title(&#039;Sequential (Blues)\nUse for: quantities, intensity')
axes[0].set_xticks([])

# Diverging palette — for data with meaningful midpoint
cmap_div = plt.cm.RdBu
for i, v in enumerate(np.linspace(0, 1, 8)):
    axes[1].bar(i, 1, color=cmap_div(v), edgecolor=&#039;none')
axes[1].set_title(&#039;Diverging (RdBu)\nUse for: correlation, profit/loss')
axes[1].set_xticks([])

# Qualitative palette — for categorical data
colors = [&#039;#E41A1C','#377EB8','#4DAF4A','#984EA3','#FF7F00','#A65628']
for i, c in enumerate(colors):
    axes[2].bar(i, 1, color=c, edgecolor=&#039;none')
axes[2].set_title(&#039;Qualitative\nUse for: distinct categories')
axes[2].set_xticks([])

plt.tight_layout()
plt.savefig(&#039;color_palettes.png', dpi=150)
plt.show()

6. Gestalt Principles in Visualization

text
123456789101112131415161718192021
Gestalt Principles (how we group visual elements):

1. Proximity    → Elements close together appear related
                  → Group related chart elements (axes, legends)

2. Similarity   → Similar-looking elements seem part of same group
                  → Use same color for same category across charts

3. Continuity   → Eyes follow paths and lines
                  → Line charts guide eyes through time

4. Closure      → Brain fills in incomplete shapes
                  → Area charts feel "complete" even if truncated

5. Figure/Ground → We separate objects from background
                  → Use white space and gridlines carefully

Application:
  Keep legends close to the data they describe.
  Use consistent colors for same categories across all charts in a report.
  Add white space — crowded charts violate closure principle.

7. Common Mistakes

  • 3D charts: 3D bar/pie charts distort proportions due to perspective — never use 3D for data that doesn't have a third dimension.
  • Dual Y-axes: Two different scales on one chart mislead viewers about the relationship between datasets.

8. MCQs

Question 1

Most accurate visual encoding for quantity?

Question 2

Pre-attentive attributes are processed in?

Question 3

Sequential color palette is for?

Question 4

Diverging palette is best for?

Question 5

Why are pie charts hard to read?

Question 6

Gestalt proximity principle means?

Question 7

Ordinal data example?

Question 8

Scatter plot best for?

Question 9

3D charts in data visualization are?

Question 10

Color hue encoding is best for?

9. Interview Questions

  • Q: How do pre-attentive attributes influence chart design?
  • Q: What is the difference between sequential and diverging color palettes?

10. Summary

Effective visualization = right data type + right chart + right encoding. Position and length for quantities. Color hue for categories. Color value (dark/light) for magnitude. Avoid angle (pie) and area (bubble) for precise comparison. Apply Gestalt principles for intuitive layouts. These fundamentals apply to every chart in this course.

11. Next Chapter Recommendation

In Chapter 4: Introduction to Matplotlib, we build our first professional charts using Python's foundational visualization library.

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: ·