Skip to main content

Module decimate

Module decimate 

Source
Expand description

Downsampling algorithms for large datasets.

When plotting millions of data points, rendering every single point is wasteful: a typical screen has at most a few thousand horizontal pixels, so most points overlap and contribute nothing to the visual output. Decimation reduces the point count to a manageable size while preserving the perceived shape of the data.

Two algorithms are provided:

  • LTTB (Largest Triangle Three Buckets) — the gold standard for perceptually faithful line downsampling. Based on the 2013 paper by Sveinn Steinarsson.
  • MinMax — a faster alternative that keeps the min and max y-value in each bucket, ensuring peaks and troughs are never lost.

Enums§

DecimateMethod
The decimation strategy to apply when rendering a line.

Functions§

lttb
Downsamples a series of (x, y) points to threshold points using the Largest Triangle Three Buckets algorithm.
minmax
Min-max decimation: keeps the min and max y-value in each bucket. Faster than LTTB, good for dense time series where peaks matter.