Overview
Plotly 5.0, released on June 16, 2021, upgrades the engine to Plotly.js 2.0 and brings significant performance improvements.
Main Features
Plotly.js 2.0
The Plotly.js 2.0 rendering engine reduces bundle size and improves complex chart rendering. Traces are loaded on demand for faster initial loading.
python
import plotly.express as px
import pandas as pd
# Interactive chart with Plotly 5
df = pd.DataFrame({
'month': ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
'sales': [120, 150, 180, 210, 195],
'target': [130, 140, 170, 200, 200],
})
fig = px.line(
df, x='month', y=['sales', 'target'],
title='Sales Tracking',
labels={'value': 'Amount', 'variable': 'Series'},
)
fig.show()
Performance improvements
Charts with many data points render faster thanks to WebGL pipeline optimization and reduced data transfer size.
python
import plotly.graph_objects as go
import numpy as np
# Performant scatter plot with many points
n = 100_000
fig = go.Figure(data=go.Scattergl( # WebGL for performance
x=np.random.randn(n),
y=np.random.randn(n),
mode='markers',
marker=dict(size=2, opacity=0.5),
))
fig.update_layout(title=f'Scatter plot ({n:,} points)')
fig.show()
