lttb
Largest-Triangle-Three-Buckets algorithm for downsampling time series-like data
What it is and what it does
lttb is a numpy-based implementation of Steinarsson's Largest-Triangle-Three-Buckets algorithm, a data reduction technique specifically designed for visual representation of time series. It removes visually redundant data points while preserving the overall shape and variability, making it useful for rendering plots with fewer points and smaller file sizes. It is not a statistical aggregation or smoothing tool—it's a visual filtering method.
The package provides a single main function, `downsample()`, which takes a 2D array (time values in the first column, metric values in the second) and returns a downsampled version with a specified number of output points. Input validation is configurable: by default it checks for two columns, strictly increasing x-values, and no NaN values, but these checks can be customized or disabled.
Use it for:
- Reduce large time series datasets for faster web-based plot rendering without losing visual fidelity.
- Compress financial or stock price time series for display in dashboards or reports.
- Downsample sensor or monitoring data (CPU usage, temperature, etc.) for visualization while retaining trend shape.
- Prepare time series for interactive charting libraries where point count affects performance.
- Filter IoT or real-time metric streams for efficient storage and display of historical data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Downsamples time series data using the Largest-Triangle-Three-Buckets algorithm to reduce visually redundant points while preserving overall shape, built on numpy.
Yes, if you need to downsample time series for visual display. The package is lightweight, has no complex dependencies, and solves a specific problem well. The dormant maintenance status is not a blocker for stable, mature code, but verify that the algorithm meets your specific data characteristics and that you don't need active support.
Install
lttb on PyPI
pip
pip install lttbuv
uv add lttbpoetry
poetry add lttbInstalling lttb
Before you install
Low friction: pure Python wheel with only numpy as a runtime dependency. Last release was 707 days ago; maintenance is dormant but the package is stable and has been tested against Python 3.12 and numpy 1.25.
License in practice
MIT license (permissive); you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install lttb
import numpy as np
import lttb
data = np.array([range(100), np.random.random(100)]).T
small_data = lttb.downsample(data, n_out=20)
Requires Python 3.8 or later and numpy; input data must be a 2D array with strictly increasing x-values (first column) by default.
Verify before relying
- Whether the package is actively maintained or accepting contributions despite dormant status.
- Performance characteristics on large datasets (e.g., millions of points).
- Whether custom validators can be easily extended for domain-specific constraints.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (~=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | dormant — 707 days since the last release |
| First released | |
| Downloads | 85,646/month — #13,911 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lttb-0.3.2-py3-none-any.whl
Tags
More Visualization packages
matplotlib creates static, animated, and…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
plotlyPlotly is an interactive, browser-based…
permissive · top 1,000 on PyPI
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
streamlitStreamlit transforms Python scripts into…
permissive · top 1,000 on PyPI
leatherLeather is a lightweight Python charting…
permissive · top 1,000 on PyPI
tsdownsampleDownsamples large time series datasets to a…
permissive · top 15,000 on PyPI
rdpImplements the Ramer-Douglas-Peucker algorithm…
permissive · top 15,000 on PyPI
stumpySTUMPY computes the matrix profile for time…
permissive · top 15,000 on PyPI
plotly-resamplerAdds dynamic data aggregation to Plotly…
permissive · top 15,000 on PyPI
dtw-pythonComputes Dynamic Time Warping alignments…
copyleft · top 15,000 on PyPI
pytorch-forecastingPyTorch Forecasting provides neural network…
permissive · top 15,000 on PyPI
dtaidistanceComputes distance measures between time series…
permissive · top 15,000 on PyPI
tslearntslearn provides machine learning algorithms…
permissive · top 15,000 on PyPI
dbl-tempoTempo provides time series operations on Spark…
permissive · top 5,000 on PyPI
time-aware-imputerFills missing values in time-series data while…
permissive · top 15,000 on PyPI