Data Visualization Guide

Turn Data into
Insight.

A minimalist, interactive guide to mastering Matplotlib and Seaborn. Learn to bridge the gap between raw numbers and human understanding.

Why Visualization Matters

"The greatest value of a picture is when it forces us to notice what we never expected to see."
— John Tukey

Reveal Patterns

Spot trends and correlations hidden in spreadsheets.

Speed Decisions

Simplify complex datasets for faster comprehension.

🎯

Tell Stories

Engage stakeholders with compelling data narratives.

For Analysts

  • Goal: Find insights
  • Style: Raw, fast, flexible

Matplotlib Basics

The foundation of Python visualization. Think of pyplot as your digital paintbrush.

FIGURE 1.0

The Line Plot

The simplest way to show trends over time. We map two lists: one for the X-axis (Years) and one for the Y-axis (Performance).

import matplotlib.pyplot as plt

years = [1990, 1992, 1994, 1996]
runs = [500, 700, 1100, 1500]

plt.plot(years, runs, 'ro--') # Red circles, dashed line
plt.xlabel("Year")
plt.ylabel("Runs")
plt.show()
FIGURE 2.0

Comparing Categories

Bar charts excel at comparing discrete quantities. Use width to control spacing and xticks to label categories correctly.

players = ["Sachin", "Sehwag", "Kohli"]
runs = [1500, 1200, 1800]

plt.bar(players, runs, 
        color="skyblue", 
        edgecolor='black')

# Add value labels
for i in range(len(players)):
    plt.text(i, runs[i] + 50, 
             str(runs[i]), 
             ha='center')

Chart Types

Choose the right tool for your data story.

Histogram

Distribution Analysis

H

Use bins to control grouping. Essential for spotting outliers and skewness.

Pie Chart

Part-to-Whole

P

Best for 3-6 categories. Use explode to highlight specific slices.

Scatter Plot

Correlation

S

Reveals relationships between two variables. Use color and size for extra dimensions.

import seaborn as sns

import matplotlib.pyplot as plt


# Load example dataset

tips = sns.load_dataset("tips")


# One line for a beautiful plot

sns.scatterplot(data=tips,

x="total_bill",

y="tip",

hue="time")

plt.show()

Upgrade

Enter Seaborn

Matplotlib gives you control, but Seaborn gives you beauty and speed. Built on top of Matplotlib, it integrates seamlessly with Pandas DataFrames.

  • Statistical Estimation Automatic linear regression fits and aggregation.
  • Themes & Palettes Switch styles with sns.set_theme().
  • Complex Grids FacetGrid for multi-plot comparisons easily.