Plotly Resampler

0.11.0 · active · verified Tue Apr 14

Plotly-resampler is a Python library designed for visualizing large time series datasets efficiently with Plotly. It extends Plotly's capabilities by dynamically resampling data based on the zoom level, ensuring smooth performance even with millions of data points. The current version is 0.11.0, and the project maintains an active development pace with frequent releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a `FigureResampler` instance to visualize a large time series dataset. It wraps a standard `plotly.graph_objects.Figure` and uses the `add_trace` method with `hf_x` and `hf_y` arguments to enable dynamic resampling.

import pandas as pd
import numpy as np
from plotly_resampler import FigureResampler
import plotly.graph_objects as go

# Create some large time series data
n_points = 1_000_000
time_index = pd.date_range("2020-01-01", periods=n_points, freq="S")
data_y = np.cumsum(np.random.randn(n_points))

# Initialize FigureResampler, wrapping a Plotly figure
fig = FigureResampler(go.Figure())

# Add a trace with resampling enabled by providing hf_x and hf_y
fig.add_trace(go.Scattergl(name='High-Frequency Data'), hf_x=time_index, hf_y=data_y)

# Show the figure (opens in browser or displays in compatible environments)
fig.show()

view raw JSON →