plotly.py: Interactive graphing library for Python
Interactive browser-based charts from Python with declarative API.
Learn more about plotly.py
plotly.py is a Python graphing library that generates interactive visualizations rendered in web browsers. It wraps plotly.js and provides a high-level, declarative API for constructing charts without requiring direct JavaScript knowledge. The library supports rendering in Jupyter notebooks, standalone HTML files, and integration with Dash applications for building dashboards. Charts are built using SVG and WebGL rendering depending on the chart type and complexity.
Declarative API design
Uses a high-level, declarative syntax through modules like plotly.express that abstract away underlying plotly.js complexity. This approach allows users to specify what data to visualize without managing rendering details.
Multiple deployment contexts
Visualizations can be rendered in Jupyter notebooks, marimo, standalone HTML files, or embedded in Dash applications. This flexibility supports different workflows from exploratory analysis to production dashboards.
Comprehensive chart library
Ships with over 30 chart types including 3D graphs, statistical charts, SVG maps, and financial charts. The underlying plotly.js library provides both SVG and WebGL rendering options for different performance and quality trade-offs.
import plotly.express as px
import pandas as pd
# Create sample data
data = {
'x_values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'y_values': [2, 5, 3, 8, 7, 6, 9, 4, 1, 10],
'categories': ['A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B'],
'sizes': [20, 30, 25, 35, 40, 15, 50, 45, 30, 25]
}
df = pd.DataFrame(data)
# Create interactive scatter plot
fig = px.scatter(df, x='x_values', y='y_values',
color='categories', size='sizes',
hover_data=['sizes'],
title='Interactive Scatter Plot')
# Update layout
fig.update_layout(width=800, height=600)
fig.show()Fixes pie trace legend and showlegend attributes to properly accept array values.
- –Fix issue where pie trace `legend`, `showlegend` attributes don't accept array values
Adds per-slice pie chart legend configuration and fixes Plotly Express template handling.
- –Fix issue where Plotly Express ignored trace-specific color sequences defined in templates via `template.data.<trace_type>`
- –Speed up `validate_gantt` function
- –Add support for arrays for the pie properties `showlegend` and `legend`, so that these can be configured per slice
Adds hovertemplate support for candlestick and OHLC traces, fixes numpy datetime handling.
- –Add `hovertemplate` for `candlestick` and `ohlc` traces
- –Fix bug where numpy datetime contained in Python list was converted to integer
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
EPG
Node.js toolkit for downloading EPG data from hundreds of TV sources into standardized XML format.
GraphiQL
Browser-based GraphQL IDE with language service tooling.
Spring Initializr
Extensible API for generating JVM projects with multi-language and build system support.
python-dotenv
Parse and load .env files into Python environments.
JSON Server
Zero-config REST API server from JSON files.