Downsampling: Largest-Triangle-Three-Buckets and the Fourier Transform

Slimmer charts, louder arguments: is the picture worth the noise

TLDR: The post shows that a chart-thinning trick (LTTB) keeps graphs pretty but can mangle what the signal “sounds” like, making a 16-beat look like 32. Commenters split between pragmatists using it for dashboards (even in ClickHouse) and purists warning “keep the phase,” with jokers pledging undying love to Fourier.

A blog demo shows a trick for making huge wiggly charts fit your screen by keeping only a few “important” points using the LTTB method. It looks fine to the eye—until you peek under the hood with a Fourier transform, which reads signals like musical notes. Suddenly a clean 16‑beat rhythm looks like 32, plus stray “harmonics.” Translation: the picture stays pretty, but the “sound” gets weird.

That’s where the comments went full battle mode. One camp waved the practicality flag: “real problem,” “we use this in IoT,” dashboards gotta load. Another camp yelled “phase!”—as in, don’t throw away the timing info of the waves unless you enjoy nonsense. A drive‑by alternative popped up with Ramer–Douglas–Peucker for visuals, cheekily warned to “rain havoc” on frequency analysis. Somewhere in between, a comedian declared eternal love: if stranded, “I’d wish for the Fourier”—the math gets the rose. Meanwhile, the toolbelt crowd flexed: ClickHouse has LTTB built in, so ship it.

The vibe: screen‑friendly vs signal‑faithful. Fans say LTTB is great for charts and bandwidth; purists call out illusions and off‑key math when you downsample too hard. It’s pixels vs. physics—with jokes, nerd romance, and links for days (LTTB)

Key Points

  • LTTB downsampling reduces time series points by selecting one significant point per bucket to preserve visual shape.
  • Applying LTTB to a 16 Hz sine wave shifts the dominant frequency in the FFT from 16 Hz to 32 Hz, indicating distortion.
  • More aggressive downsampling (e.g., to 256 samples) increases spectral distortion and alters apparent base frequency.
  • Nyquist–Shannon theorem requires sampling at least twice the highest frequency; for 16 Hz, at least 32 Hz is needed.
  • At the minimum sampling threshold, the original frequency can be inferred; below it, the signal becomes completely distorted.

Hottest takes

"And phase! Good luck trying to reconstruct your signal after you discard the phase" — sevensor
"If stuck on a desert island… I’d wish for the Fourier" — toddwprice
"It can and will rain havoc in the Fourier space" — srean
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.