Visualization
A collection of data visualization recipes using Matplotlib, Seaborn, and Plotly. Learn various visualization techniques from basic charts to interactive dashboards.
Library Comparison
| Library | Features | When to Use |
|---|---|---|
| Matplotlib | Basic, fine-grained customization | Static charts for papers, reports |
| Seaborn | Specialized for statistical visualization, beautiful default styles | EDA, distribution/correlation analysis |
| Plotly | Interactive, web-based | Dashboards, presentations |
| Altair | Declarative grammar, concise | Quick exploratory analysis |
Curriculum
1. Basic Charts
BeginnerLearn basic charts such as bar graphs, line charts, and scatter plots.
- Bar Chart
- Line Chart
- Scatter Plot
- Pie Chart
- Histogram
Get Started with Basic Charts β
2. Heatmaps
IntermediateLearn how to visualize correlations and time-based patterns using heatmaps.
- Correlation Heatmap
- Time x Day of Week Heatmap (Activity Patterns)
- Pivot Table-based Heatmap
- Clustermap
3. Treemaps
IntermediateLearn treemaps that represent hierarchical data using area.
- Sales Share by Category
- Hierarchical Structure Representation (Department > Team > Product)
- Expressing Performance with Color (Growth Rate, etc.)
- Using Plotly and Squarify
4. Sankey Diagrams
IntermediateAdvancedLearn Sankey diagrams that visualize flow.
- Marketing Funnel Visualization
- Channel Conversion Flow
- Customer Journey Analysis
- Node and Link Configuration
Get Started with Sankey Diagrams β
5. Geospatial Visualization
IntermediateAdvancedLearn map-based data visualization methods.
- Interactive Maps with Folium
- Choropleth Maps
- Markers and Popups
- Location-based Clustering
Get Started with Geospatial Visualization β
6. Animated Charts
AdvancedLearn how to express changes over time through animation.
- Matplotlib Animation
- Plotly Express Animation
- Ranking Changes Over Time (Racing Bar Chart)
- Exporting to GIF/MP4
Get Started with Animated Charts β
7. Interactive Dashboards
AdvancedLearn to build interactive dashboards using Plotly and Streamlit.
- Plotly Dash Basics
- Streamlit Dashboard
- Filters and Callbacks
- Real-time Data Integration
Chart Selection Guide
For Comparison:
- Category comparison β Bar Chart
- Changes over time β Line Chart
- Ranking comparison β Horizontal Bar Chart
For Distribution:
- Single variable distribution β Histogram, Box Plot
- Relationship between two variables β Scatter Plot
- Correlation matrix β Heatmap
For Composition:
- Proportion of total β Pie Chart, Treemap
- Sum of parts β Stacked Bar Chart
- Flow/Conversion β Sankey Diagram
For Geography:
- Regional values β Choropleth
- Location markers β Marker Map
- Density β Heatmap Map
Basic Setup Code
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import plotly.graph_objects as go
# Matplotlib Korean font settings
plt.rcParams['font.family'] = 'AppleGothic' # macOS
# plt.rcParams['font.family'] = 'Malgun Gothic' # Windows
# plt.rcParams['font.family'] = 'NanumGothic' # Linux
plt.rcParams['axes.unicode_minus'] = False
# Default style settings
plt.style.use('seaborn-v0_8-whitegrid')
sns.set_palette('husl')
plt.rcParams['figure.figsize'] = (12, 6)
# Plotly default template
import plotly.io as pio
pio.templates.default = 'plotly_white'Recommended Color Palettes
| Purpose | Palette | Code |
|---|---|---|
| Categorical | tab10 | sns.color_palette('tab10') |
| Sequential | Blues | sns.color_palette('Blues') |
| Diverging | RdYlGn | sns.color_palette('RdYlGn') |
| Emphasis | Set2 | sns.color_palette('Set2') |