Plotly
Python graphing library for creating interactive, publication-quality visualizations with 40+ chart types.
Quick Start
Install Plotly:
Basic usage with Plotly Express (high-level API):
Choosing Between APIs
Use Plotly Express (px)
For quick, standard visualizations with sensible defaults:
- Working with pandas DataFrames
- Creating common chart types (scatter, line, bar, histogram, etc.)
- Need automatic color encoding and legends
- Want minimal code (1-5 lines)
See reference/plotly-express.md [blocked] for complete guide.
Use Graph Objects (go)
For fine-grained control and custom visualizations:
- Chart types not in Plotly Express (3D mesh, isosurface, complex financial charts)
- Building complex multi-trace figures from scratch
- Need precise control over individual components
- Creating specialized visualizations with custom shapes and annotations
See reference/graph-objects.md [blocked] for complete guide.
Note: Plotly Express returns graph objects Figure, so you can combine approaches:
Core Capabilities
1. Chart Types
Plotly supports 40+ chart types organized into categories:
Basic Charts: scatter, line, bar, pie, area, bubble
Statistical Charts: histogram, box plot, violin, distribution, error bars
Scientific Charts: heatmap, contour, ternary, image display
Financial Charts: candlestick, OHLC, waterfall, funnel, time series
Maps: scatter maps, choropleth, density maps (geographic visualization)
3D Charts: scatter3d, surface, mesh, cone, volume
Specialized: sunburst, treemap, sankey, parallel coordinates, gauge
For detailed examples and usage of all chart types, see reference/chart-types.md [blocked].
2. Layouts and Styling
Subplots: Create multi-plot figures with shared axes:
Templates: Apply coordinated styling:
Customization: Control every aspect of appearance:
- Colors (discrete sequences, continuous scales)
- Fonts and text
- Axes (ranges, ticks, grids)
- Legends
- Margins and sizing
- Annotations and shapes
For complete layout and styling options, see reference/layouts-styling.md [blocked].
3. Interactivity
Built-in interactive features:
- Hover tooltips with customizable data
- Pan and zoom
- Legend toggling
- Box/lasso selection
- Rangesliders for time series
- Buttons and dropdowns
- Animations
For complete interactivity guide, see reference/export-interactivity.md [blocked].
4. Export Options
Interactive HTML:
Static Images (requires kaleido):
For complete export options, see reference/export-interactivity.md [blocked].
Common Workflows
Scientific Data Visualization
Statistical Analysis
Time Series and Financial
Multi-Plot Dashboards
Integration with Dash
For interactive web applications, use Dash (Plotly's web app framework):
Reference Files
- plotly-express.md [blocked] - High-level API for quick visualizations
- graph-objects.md [blocked] - Low-level API for fine-grained control
- chart-types.md [blocked] - Complete catalog of 40+ chart types with examples
- layouts-styling.md [blocked] - Subplots, templates, colors, customization
- export-interactivity.md [blocked] - Export options and interactive features
Additional Resources
- Official documentation: https://plotly.com/python/
- API reference: https://plotly.com/python-api-reference/
- Community forum: https://community.plotly.com/

