Module 3 · Statistical Visualization with Seaborn

Section 3: Categorical Data Visualization

Bar Plots · Count Plots · Box Plots · Strip & Swarm · Point Plots

🏷️ Categorical Data Types
  • Nominal: no order (region, product, department)
  • Ordinal: ordered categories (low / medium / high)
  • Binary: two states (yes/no, active/inactive)
  • Requires different chart types than continuous data
📊 Bar Plots (Aggregated)
  • sns.barplot(data=df, x="cat", y="val")
  • Shows mean by default with 95% confidence interval
  • Change estimator: estimator=np.median
  • hue adds a second categorical dimension
🔢 Count Plots
  • sns.countplot(data=df, x="category")
  • Counts rows per category — no numeric column needed
  • Order bars: order=df["col"].value_counts().index
  • Best for: frequency tables, survey responses
🎯 Strip & Swarm Plots
  • sns.stripplot() — individual data points per category
  • sns.swarmplot() — non-overlapping point layout
  • Layer over boxplot to show data density
  • Reveals sample size and distribution shape together
📍 Point Plots
  • sns.pointplot() — mean + CI connected by line
  • Great for category × time interaction effects
  • Compare trend direction across groups with hue
  • Communicates statistical uncertainty visually
🧪 Lab 3 — Categorical Visualizations
  • Part A: Product line performance bar and count plots
  • Part B: Regional performance trends with point plots
  • Layer strip plot over box plot to show raw data
  • Order categories by frequency for cleaner display