5.
5 Interactive Plots using Plotly
Python library for interactive and
publication-quality visualizations
What is Plotly?
• Open-source graphing library by Plotly
Technologies Inc.
• Emphasis on interactivity (zoom, pan, hover,
explore)
• Works well for business dashboards, data
exploration, and presentations
Built-in Datasets in Plotly
• Gapminder – population, life expectancy, GDP
per capita
• Finance – stock prices, trading volume,
candlesticks
• Economics – inflation, unemployment, GDP
growth
• Climate – temperature, rainfall, sea ice extent
Advantages of Plotly
• Interactive Visualization (hover, zoom, filter)
• Publication-quality graphics (customizable,
sleek)
• Versatility (scatter, line, bar, heatmap, 3D, etc.)
• Integration with Pandas, NumPy, Dash
Limitations of Plotly
• Steep learning curve for beginners
• Performance issues with very large datasets
• Limited offline functionality
• Smaller community support compared to
Matplotlib/Seaborn
Plotly Graph Objects (go)
• Low-level, flexible, highly customizable
• Example: [Link], [Link], [Link],
[Link], etc.
Plotly Express (px)
• High-level, concise, great for quick plots
• Example: [Link], [Link], [Link],
[Link], etc.
When to Use GO vs PX
• Use Plotly Express (px): Quick exploration,
simple plots, minimal code
• Use Graph Objects (go): Complex/customized
plots, multiple traces, fine-grained control
Summary
• Plotly = interactive, high-quality visualizations
• Built-in datasets make learning easy
• Two APIs: Plotly Express (px) – simple, fast;
Graph Objects (go) – powerful, flexible
• Widely used in data analysis, finance, and
dashboards