Static vs Interactive: The Decision Framework
The choice between static and interactive visualization is a cognitive design decision that affects how viewers process information.
Plotly Express: The Grammar of Interactive Graphics
Scatter Plots
Line Charts
Bar Charts
Histograms and Distribution Plots
Box and Violin Plots
Subplots: Multi-Panel Layouts
Secondary Y-Axes
Statistical Visualizations
Correlation Heatmaps
Geographical Maps
Animated Charts
Dashboard-Ready: Updatemenus and Sliders
Customizing Themes and Export
Library Comparison
| Criterion | Matplotlib | Seaborn | Plotly |
|---|---|---|---|
| Best for | Fine-grained control | Statistical plots | Interactive dashboards |
| Interactivity | None | None | Native |
| Statistical models | Manual | Built-in | Limited |
| 3D plotting | Axes3D | Limited | scatter_3d |
| Animation | FuncAnimation | Limited | animation_frame |
| Export quality | Excellent | Excellent | Good (kaleido) |
| Browser embedding | No | No | Yes |
Key Takeaways
Practice Exercises
- Create an interactive scatter plot using
px.data.iris()with marginal distributions and a trendline - Build a 2x3 subplot dashboard using the
px.data.gapminder()dataset - Create the animated Gapminder bubble chart with custom colorscale and range slider
- Create a masked correlation heatmap (upper triangle only) with annotations
- Create a choropleth map colored by GDP per capita with scatter_mapbox overlay