Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Downsampling (LTTB)

Reduce massive datasets while preserving visual shape using the Largest-Triangle-Three-Buckets algorithm. A 10M-point scatter chart becomes 5K points indistinguishable to the eye.

Python

import seraplot as sp

chart = sp.scatter(title="Big scatter", x_values=big_x, y_values=big_y).downsample()

downsample is a chainable Chart method, not a standalone sp. function — there is no Python sp.lttb(); the algorithm is only registered on the JS/WASM side today (downsampleLttb, below).

JavaScript

import { downsampleLttb } from "seraplot";
const reduced = JSON.parse(downsampleLttb(JSON.stringify({ x, y, threshold: 5000 })));

Why LTTB?

MethodPreserves peaksSpeedVisual fidelity
Random sampleNoFastPoor
Every-NthMaybeFastOK
LTTBYesFastExcellent

Réduit les datasets massifs en préservant la forme visuelle avec l'algorithme Largest-Triangle-Three-Buckets. Un scatter de 10M points devient 5K points indistinguables à l'œil.

Python

import seraplot as sp

chart = sp.scatter(title="Grand scatter", x_values=big_x, y_values=big_y).downsample()

downsample est une méthode chaînable sur Chart, pas une fonction sp. autonome — il n'y a pas de sp.lttb() en Python ; l'algorithme n'est enregistré que côté JS/WASM aujourd'hui (downsampleLttb, ci-dessous).

JavaScript

import { downsampleLttb } from "seraplot";
const reduced = JSON.parse(downsampleLttb(JSON.stringify({ x, y, threshold: 5000 })));

Pourquoi LTTB ?

MéthodePréserve les picsVitesseFidélité visuelle
Échantillon aléatoireNonRapideMauvaise
Tous les NPeut-êtreRapideOK
LTTBOuiRapideExcellente