DATA VISUALIZATION — COMPLETE NOTES
1. Introduction to Data Visualization
Data visualization is the graphical representation of information using charts, graphs, maps, and other visual tools. It helps audiences
understand complex datasets quickly by revealing patterns, trends, and relationships hidden in raw data.
Why it matters (especially in Economics & Social Sciences)
Large and complex datasets require visualization for meaningful interpretation.
Makes reports clearer, more appealing, and more persuasive.
Helps communicate evidence effectively to both technical and non-technical audiences.
Supports storytelling, research communication, and policy analysis.
Brief History
Early examples include maps, astronomical charts, and the first statistical graphics (17th–19th centuries).
19th–20th centuries: development of principles involving the use of position, color, shape, and invention of many chart types.
Recent decades: rapid growth due to computing, interactive visualization, and user-friendly software.
What Makes a Visualization Effective?
1. Informative – Conveys key insights clearly.
2. Efficient & Clear – Uses correct scales, labels, chart types; avoids ambiguity.
3. Attractive – Aesthetic but not distracting; draws attention to important points.
4. Interactive (modern) – Allows filtering, drilling down, exploring data.
Relevance for Economics and Policy
Helps analyse trends (GDP, inflation), compare groups (rural/urban), and examine relationships (education–income).
Clear visuals strengthen arguments in research papers, presentations, and policy briefs.
2. Data Types
Understanding data types is essential for correct analysis, visualization, and interpretation.
A. Main Classification
1. Quantitative (Numerical) Data
Represent amounts or magnitudes.
Arithmetic operations (mean, ratios) are meaningful.
Examples: income, age, marks, GDP, price.
Subtypes:
1. Continuous
o Can take any value in an interval.
o Examples: height, wage rate, interest rate.
o Visuals: histogram, density plot, line chart, boxplot.
2. Discrete
o Countable values, often integers.
o Examples: number of children, number of firms.
o Visuals: bar chart, dot plot.
2. Qualitative (Categorical) Data
Represent groups or labels.
Usually analysed using counts or percentages.
Examples: gender, occupation, state, sector.
Subtypes:
1. Nominal
o No natural order.
o Examples: region, religion, brand.
o Visuals: bar/pie chart.
2. Ordinal
o Ordered categories; distances not defined.
o Examples: satisfaction (low/medium/high), education level.
o Visuals: ordered bar chart, stacked bars.
B. Measurement Scales
1. Nominal – Only labels; no ordering.
2. Ordinal – Ordered categories; no equal spacing.
3. Interval – Equal intervals, arbitrary zero (example: °C temperature).
4. Ratio – True zero; all arithmetic meaningful (example: income, quantity).
Why important?
Prevents mistakes (e.g., averaging nominal codes).
Determines valid statistical summaries and visualizations.
C. Typical Questions by Data Type
Numerical: What is the average? Is there a trend? Relationship between variables?
Categorical: How many in each group? What are the percentages?
Mixed: How do numerical values differ across categories (e.g., wages by education level)?
D. Choosing Visuals Based on Data Type
Data Situation Suitable Visuals
Single numerical variable Histogram, boxplot, density
Single categorical variable Bar chart, pie chart
Numerical vs numerical Scatterplot
Numerical vs categorical Grouped bar/boxplots
Data Situation Suitable Visuals
Categorical vs categorical Mosaic plot, stacked bars
3. From Data to Visualization
This process explains how raw data becomes a well-designed graph.
1. Key Steps
Step 1: Clarify the purpose
What question are we answering?
Who is the audience (student, policy-maker, general public)?
Step 2: Understand the data
Identify variable types.
Check missing values, outliers, errors.
Step 3: Choose the relationship to show
Distribution (one variable)
Comparison across categories
Association between variables
Change over time
Composition (parts of a whole)
Step 4: Select appropriate graph
Distribution: histogram, density, boxplot
Comparison: bar chart, dot plot
Relationship: scatterplot
Time series: line graph
Composition: stacked bars, area chart
2. Data → Visual Encodings
Visual elements used to represent data:
Position
Most accurate representation of quantity (e.g., bar height, point position).
Length, Angle, Area
Length is easy to compare (bar charts).
Angles (pie charts) harder to interpret.
Area/bubbles often misleading unless necessary.
Color
Hue differentiates categories.
Lightness/darkness shows order or magnitude.
Use color-blind-friendly palettes.
Shape & Line Type
Used to differentiate groups (e.g., dotted vs solid line).
3. Principles of Good Visual Design
1. Show data clearly
o Avoid 3D charts, heavy shading, misleading axes.
2. Declutter
o Remove unnecessary gridlines, borders, duplicate labels.
3. Emphasize what matters
o Use color or annotations for key points.
4. Self-explanatory graph
o Title with a message (e.g., “Inflation fell after 2017”).
o Proper axis labels, units, legend.
5. Consistency & readability
o Same color scheme, scale, fonts across graphs.
o Adequate white space.
4. Common Pitfalls
Wrong chart for data type.
Too many categories in one chart.
Blind use of software defaults.
Poor labeling or misleading scales.
Ignoring audience needs.
4. Data Storage
Data storage refers to how datasets are saved, structured, and prepared for analysis and visualization.
A. Common Storage Formats
1. Text-Based Formats
CSV, TSV
Simple, lightweight, widely used.
No metadata; everything imported as text.
2. Spreadsheet Formats
Excel (.xlsx, .xls), Google Sheets
Easy to use but prone to messy formatting (merged cells, inconsistent types).
Excel can unintentionally change dates/codes.
3. Statistical Software Formats
R: .rds, .RData
Stata: .dta
SPSS: .sav
Preserve data types, labels, coding information.
4. Database Formats
SQL (MySQL, PostgreSQL, SQLite)
HDF5, Feather for large datasets
Efficient for storing and querying millions of rows.
B. Data Structures for Visualization
1. Tidy (Long) Format
Each variable = column
Each observation = row
Each table = one type of unit
Best for R/ggplot2, Python/matplotlib, seaborn.
2. Wide Format
Multiple variables spread across columns (e.g., income_2010, income_2011).
Good for spreadsheets; must be reshaped for visualization.
C. Principles for Good Storage
Rectangular format (no merged cells or totals inside data).
Consistent column names (no spaces or special characters).
Correct data types (numeric, date, categorical).
Clear handling of missing values (e.g., NA).
A separate data dictionary/README.
D. Economics-Specific Examples
Source Format Problem Solution
NSSO/RBI CSV/Excel Multiple sheets, coded categories Read specific sheets; recode
World Bank CSV/API Metadata rows, wide data Skip rows; convert to long
Administrative data Stata/Excel Labels stored separately Merge metadata
Panel data CSV/Stata ID–year mismatch Reshape to tidy format
E. Tools for Handling Formats
R
readr (CSV), readxl (Excel), haven (Stata), DBI (databases).
Python
pandas (all formats), openpyxl (Excel).
Spreadsheet Tools
Excel, Google Sheets, LibreOffice (for small tasks).
LESSON 2 — From Data to Visualization & Principles of Good Visual Design
1. The Power and Purpose of Data Visualization
Modern decision-making depends on evidence, but raw data (rows, tables, numbers) cannot be interpreted quickly or easily. Visualization
converts numerical information into visual structures that the brain processes rapidly.
Why Visualization Matters
The human brain processes visuals 60,000× faster than text.
Helps detect patterns, clusters, anomalies, and trends without reading thousands of numbers.
Four Core Purposes
1. Sense-making – finding structure in data.
2. Communication – conveying insights to non-technical audiences.
3. Memory retention – visuals are remembered more easily than numbers.
4. Persuasion through evidence – visuals strengthen arguments when honest.
Golden Rule
A visualization must reveal the truth, not decorate it.
2. Understanding Data: The Raw Material for Visualization
Correct visualization depends on understanding the structure and measurement scale of data.
2.1 Types of Data by Structure
1. Cross-sectional
Data from many units at one time.
Example: expenditure of 500 households.
2. Time-series
Data from one unit over time.
Example: monthly GDP, daily stock prices.
3. Panel/Longitudinal
Many units tracked over time.
Example: productivity of 200 firms from 2010–2025.
Used in STATA, SQL, Pandas, etc.
2.2 Data Types by Measurement Scale
Scale Type Nature Valid Comparisons Examples
Nominal Categories, no order Equality only Gender, region
Ordinal Categories with order Order, not magnitude Low < Medium < High
Scale Type Nature Valid Comparisons Examples
Interval Numeric, equal intervals, no true zero Differences only Temperature °C
Ratio Numeric, true zero Differences + ratios Sales, income
Important
Bar charts must start at zero for ratio data.
Do NOT use bar-length comparisons for interval or ordinal scales—they imply false ratios.
2.3 Responsibility of Data Cleaning
A visualization built on dirty data is a confident lie.
Cleaning must include:
Removing duplicates
Handling missing values
Fixing entry errors
Standardizing units (₹, %, kg)
Calculating summaries (mean, totals, growth)
Transformations (log scale, indexing)
Tools: Pandas, Excel Power Query, SQL, R.
3. The Visualization Pipeline — Turning Numbers into Narrative
Visualization is a 5-step reasoning process:
1. Problem definition
→ What question must the data answer?
2. Data preparation
→ Is data clean and structured?
3. Chart mapping
→ Which graph answers the question best?
4. Design encoding
→ Which visual principles ensure accuracy?
5. Refinement
→ Remove clutter, improve readability, ensure honesty.
Insight drives design—not software templates.
4. Matching Questions to Graph Types
Before picking a chart, identify the question type.
4.1 Comparison Questions
Used to compare categories.
Chart Best for Limits
Bar/Column Category comparison Must start at zero
Chart Best for Limits
Lollipop Cleaner ranked comparison Less volume clarity
4.2 Trend-over-Time Questions
Chart Best for Limits
Line Chart Time patterns, seasonality Too many lines cause overlap
Area Chart Trend + magnitude Exaggeration if transparency misused
4.3 Distribution Questions
Chart Best for
Histogram Frequency distribution
Box Plot Median, quartiles, outliers
Density Plot Smooth distribution
4.4 Relationship Questions
Chart Best for
Scatter Plot Correlation, clusters
Bubble Chart Extra variable (size)
Heatmap Intensity of relationship
4.5 Composition Questions (Parts of Whole)
Chart Best for Limitations
Stacked Bar Proportion within groups Hard to compare segments
Pie/Donut 2–3 large groups Useless beyond 5 categories
5. How We Read Visuals — Encoding Channels
Visualization uses encoding channels to represent data.
Encoding Channel Accuracy Example
Position Highest Scatter points
Length Very high Bar height
Angle Low Pie chart slice
Area/Size Medium Bubble chart
Color intensity Good for heat Heatmaps
Encoding Channel Accuracy Example
Shape Good for categories Scatter plot categories
Position and length = best.
Angles and 3D = worst and most misleading.
6. Principles of Good Visual Design
These principles ensure clarity, honesty, and efficiency.
6.1 Principle 1 — Clarity
A good chart is self-explanatory.
Avoid 3D effects
Remove non-data ink (decorations, heavy gridlines)
Prefer direct labels over legends
Avoid clutter
6.2 Principle 2 — Honesty in Scale
Two strict rules:
1. Bars for ratio data must start at zero
2. Time-series lines must use proportional scales
Misleading axes exaggerate differences dramatically.
6.3 Principle 3 — Pre-attentive Attributes
Instantly noticed visual cues:
Color
Contrast
Size
Length
Position
Direction
Use them to highlight insights—not distract.
6.4 Principle 4 — Visual Hierarchy
Guide the viewer's eye:
1. Insightful title
2. Main visual pattern
3. Axes & labels
4. Notes & source
Weak title: Company Sales Chart
Strong title: Sales increased 35% after discounting.
6.5 Principle 5 — Color Must Serve Meaning
Use ≤5 colors
Maintain consistent mapping
Avoid red/green combinations
Use color-blind safe palettes (ColorBrewer)
6.6 Principle 6 — Typography
Minimum font size: 8 pt
Avoid ALL CAPS
Avoid vertical text
Stick to one font family
6.7 Principle 7 — Simplicity
Ask:
Can this be understood in 5 seconds?
Does every element serve meaning?
Remove anything decorative.
6.8 Principle 8 — Provide Context
Include:
Mild annotations
Benchmarks
Captions when needed
Data source
6.9 Principle 9 — Avoid Illusionary Correlations
Do not imply relationships not backed by statistics.
Visual correlation ≠ real correlation.
Use regression, tests (t, F, χ²), confidence intervals, etc., when needed.
7. Common Visualization Mistakes
Mistake Why it happens Harm
Pie chart with 10 categories Software defaults People cannot compare angles
Bar axis not starting at zero To zoom-in visually False exaggeration
Too many colors Aesthetic attempt Confusion and loss of meaning
Using 3D charts Looks “fancy” Distorts perception
No insight title Focus on tool, not message Audience confused
Overplotting many trend lines Trying to show all data Noise > signal
8. Visualization Tools Ecosystem
Google Sheets – beginners
R (ggplot2) – economists/statisticians
Python (Matplotlib, Seaborn) – data scientists
Power BI – business dashboards
Tableau, Adobe Illustrator – publication-quality visuals
9. Visualization Ethics
A chart carries moral responsibility because viewers rarely verify the underlying data.
Ethical rules:
1. No exaggeration/minimization of differences
2. Visual proportions must match numeric reality
3. Axes must respect measurement scales
4. Colors should not manipulate emotion
5. Patterns shown must match real data
10. Practical Example (Line Chart)
Dataset: Monthly revenue (₹ lakh)
Jan 48 • Feb 52 • Mar 55 • Apr 49 • May 63 • Jun 72
Analysis question: When did revenue peak and what is the pattern?
Correct visualization choice
Line chart (time-series)
Title: Revenue peaked in June; steady rise before summer demand.
Label axes clearly
Highlight the peak
Remove unnecessary gridlines
11. Data Storytelling + Statistical Validation
Use visuals for communication but verify claims using statistics:
OLS regression
Hypothesis tests (t, F, χ²)
Correlation matrices
Elasticities
Growth rates
Confidence intervals
Visuals + statistics = credible insight.
12. Visualization Quality Rubric (100 Marks)
Criterion Marks
Clarity 20
Accuracy 25
Design discipline 20
Accessibility 15
Insightful title 20
Total 100
13. Final Guiding Principles
An effective visualization is:
Insight-driven, not template-driven
Cognitively precise
Ethically honest
Minimal but contextual
Audience-friendly
Readable without explanation
Statistically validated when needed
Introduction
Economics is fundamentally a discipline of inference, explanation, and influence. Economists observe real-world phenomena through data
—prices, wages, production levels, consumption patterns, employment cycles, trade flows, firm growth, and policy impacts. Yet data alone
does not create knowledge. For data to become evidence, and for evidence to shape decisions, two essential transformations are required:
1. Technical transformation
Raw data must be cleaned, standardized, merged, reshaped, and validated.
2. Communicative transformation
Analytical insights must be communicated clearly—through visual design, narrative structure, cognitive accessibility, and honest
representation.
The first process is data wrangling.
The second is data persuasion—not emotional persuasion, but logical influence grounded in clarity, ethical visual design, and statistical
validation.
Economists do more than analyze datasets; they communicate policy implications, decipher market behavior, and translate numbers into
public understanding. A rich dataset poorly communicated may fail to influence; a modest dataset, properly wrangled and ethically
visualized, can reshape economic thinking, corporate strategy, or policy action.
2. Data Wrangling: The Backbone of Economic Communication
In academic exercises, students often receive clean, well-structured datasets. In real-world economic systems, data is messy and
inconsistent. Before analysis or visualization, data must undergo systematic transformation to eliminate distortions and reveal economic
truth.
2.1 The Real Characteristics of Raw Economic Data
Because economic data is human-recorded or institution-recorded, it often contains:
Multiple names for the same entity (e.g., “U.P.”, “UP”, “Uttar Pradesh”)
Separate files from different enumerators or agencies
Different units for income, expenditure, output, tax, or trade flows
Incorrect or inconsistent date formats
Missing values due to non-response or recording failures
Duplicates from multi-stage data exports
Outliers—sometimes real economic shocks; sometimes errors
Non-relevant variables that dilute analytical focus
Raw data may contain truth, but not meaning until wrangling provides structure.
2.2 Data Wrangling Toolkit for Economics Students
Conceptual understanding is essential, but practical execution depends on tools such as:
Python (Pandas) for cleaning, transformation, reshaping
Apache Spark for large-scale processing of national datasets
SQL (PostgreSQL) for relational storage and merging
Tableau / Power BI for visualization and dashboards
Adobe Illustrator for print-quality academic charts
The tool enables automation—but the economist ensures correctness, consistency, and ethical discipline.
2.3 Stages of Data Wrangling in Economic Analysis
Stage 1: Data Acquisition
Common sources include:
Household consumption surveys
Public datasets from Kaggle or national repositories
Primary surveys conducted through digital forms
Official macroeconomic indicators from RBI, Census, or Planning Commission
Data must be credible, time-stamped, and comparable before being used.
Stage 2: Parsing and Format Standardization
Datasets appear in formats like:
CSV
Excel
JSON
API outputs
HTML-scraped tables
SQL exports
Incorrect parsing can produce misleading aggregates even when the data “looks correct.”
Stage 3: Cleaning the Data
Key tasks include:
1. Standardizing identifiers (e.g., names, regions)
2. Unit consistency (₹, lakh, crore; kg, tonne, etc.)
3. Standardizing date formats for time-series
4. Duplicate removal to avoid bias
5. Handling missing values using appropriate strategies
6. Correcting impossible entries (e.g., negative age)
7. Verifying outliers rather than blindly removing them
Goal: Fix noise, not behavior.
Stage 4: Reshaping the Data
Different analyses require different structures:
Long format: suitable for time trends
Wide format: ideal for category-level comparisons
Regression-ready matrices: numeric and complete
Policy segmentation: grouping by region, gender, income class
Derived variables: elasticity, growth rate, ratio measures, index values
Stage 5: Data Merging and Joins
Economics often involves combining datasets, such as:
Household income + consumption
State GDP + employment
Firm input + output data
Trade flows + exchange rates
Merging requires correct keys (household ID, state-year, firm-year).
Incorrect joins produce visual lies, even if charts appear valid.
3. The Art of Persuading with Data: An Economist’s Communication Language
Persuasion in economics comes from logical clarity, not emotional appeal. Effective communication combines:
Clear narratives
Cognitive-friendly design
Truthful visualization
Statistical validation when needed
Economics persuasion appears in three forms:
stories, charts, and validated inference.
3.1 The Four Pillars of Data Persuasion
Pillar 1: Credibility
Transparent sources
Verified outliers
Honest preprocessing
No hidden imputations
No fabricated or exaggerated visuals
Pillar 2: Cognitive Usability
The audience should instantly detect:
Who is compared
What increases or decreases
How large differences are
What pattern emerges
If comprehension takes > 30 seconds, persuasion is lost.
Pillar 3: Communication Aesthetics
Effective charts follow:
Minimal clutter
Honest axis scales
Clear visual hierarchy
Purposeful colors
Horizontal labels
Simple annotations
Elegance emerges from discipline, not decoration.
Pillar 4: Ethical Interpretation
Bars start at zero for ratio-scale data
Time-series slopes preserved
No 3D distortions
No false correlation implied without statistical proof
No emotionally manipulative colors
3.2 The Persuasion Pipeline for Economists
1. Define the analytical question
2. Wrangle the data to answer the question
3. Choose the appropriate visualization
4. Encode the conclusion in the title
5. Label axes and units clearly
6. Add light annotations
7. Provide data source
8. Validate with statistical methods (e.g., OLS, t-tests) if relationships are claimed
4. Visualization Psychology in Economic Influence
Visual decoding is governed by cognitive accuracy.
Perception accuracy ranks as:
1. Position on scale (strongest)
2. Length
3. Area
4. Color grouping
5. Angle (weak—pie charts)
6. 3D depth (misleading)
Thus, economists rely on:
Line charts → trends
Bar/column charts → category comparison
Scatter plots → relationships
Stacked bars → composition
Histogram/boxplot → distribution
5. Chart Library with Economics Use-Cases
1. Bar/Column Charts (Comparison)
Examples:
Wheat output across states
Sectoral employment shares
Firm-level cost comparison
2. Line Charts (Trends)
Examples:
GDP growth over quarters
Price inflation cycles
Seasonal fluctuations in demand
3. Scatter Plots (Relationships)
Examples:
Income vs discretionary spending
Price vs quantity (elasticity patterns)
4. Histograms/Boxplots (Distribution)
Examples:
Wage distribution
Consumption inequality
5. Stacked Bars (Composition)
Examples:
Tax revenue sources
Sector-wise GDP contribution
6. Economics Case Studies (Expanded)
Case Study A: Development Economics
Topic: Consumption inequality across Indian states
Issues:
Mixed naming
Missing income values
Unit inconsistencies
Duplicates
Need for monthly aggregation
Wrangling:
Standardized state names
Converted income to ₹ lakh
Median imputation
Duplicate removal
Reshaping to long format
Message encoded:
“High-income households spend 3× more on discretionary festival goods; demand rises sharply post-monsoon.”
Visuals:
Line charts for trends
Bars for magnitude
Scatter for validating relationships
Case Study B: Behavioral Economics
Issue:
Ordinal preference data was plotted using bar heights → creates false magnitude comparisons.
Correction:
Use ordered categories or scatter-like positions, not ratio-implying bar lengths.
Lesson:
Truthful design strengthens economic inference.
Case Study C: Firm Theory
Topic: Input-output efficiency over 10 years
Wrangling:
Merged by firm-year
Indexed outputs
Filtered cost variables
Created regression-ready frame
Statistical validation:
OLS regression confirmed correlation.
Encoded message:
“Digital adoption explains 50% of productivity divergence post-2019 (95% confidence).”