Skip to content
Bug reportDec 1, 2026· 0:22· 16 views

Observable Plot 0.6.19: normalizeY("deviation") renders NaN as zero for a constant series

0:22 total

Comments · 0

Be the first to comment.

Bug reportby SceneRecap AI

mediumnormalizeY / normalize "deviation" basis in the Plot transforms. The likely cause: when the standard deviation is 0 for a constant series, the output is set to 0 for every index. This overwrites NaN inputs instead of keeping them NaN so they get filtered.
d3: d3@7 via cdn.jsdelivr.netos: macOSdpr: 1locale: en-USbrowser: Chromium 151.0.7922.34library: @observablehq/plot 0.6.19 via cdn.jsdelivr.nettimezone: Europe/Berlinviewport: 1280x720

Repro steps

  1. 1.Load a page that includes d3@7 and @observablehq/plot@0.6.19 from cdn.jsdelivr.net.
  2. 2.Render a dot mark with Plot.normalizeY("deviation", {x: (_, i) => i, y: d => d}) on data [2, 2, NaN].
  3. 3.Render the same mark on data [2, 2, null] as a control.
  4. 4.Count the circles rendered in each chart.

Expected

The NaN value at index 2 should be dropped, as the null value is in the control. Two circles should render at index 0 and 1.

Actual

Three red circles render at normalised deviation 0.0 for index 0, 1 and 2. The NaN at index 2 is drawn as 0 instead of being omitted. The badge reads 'circles rendered: 3, expected 2'.

Evidence

visualBUG panel (data [2, 2, NaN]) shows three red circles at y = 0.0 for index 0, 1 and 2.
visualBUG badge reads 'circles rendered: 3, expected 2'.
visualCONTROL panel (data [2, 2, null]) shows two green circles at 0.0 for index 0 and 1. The badge reads 'circles rendered: 2, expected 2'. The control works correctly.
visualAfter a brief scroll, the BUG panel still shows three circles and the badge still reads 'circles rendered: 3, expected 2'. The output is stable.
consoleTwo parser-blocking cross-site script warnings appear for d3@7 and plot@0.6.19 loaded via document.write. No errors are logged. These warnings are likely unrelated.
Issue markdown (copy-paste ready)
## normalizeY("deviation") draws a NaN input as 0 when the remaining series is constant

**Version:** @observablehq/plot 0.6.19 (cdn.jsdelivr.net), d3@7
**Environment:** Chromium 151.0.7922.34, macOS, 1280x720
**Related:** #2482

### Repro
```js
Plot.dot([2, 2, NaN], Plot.normalizeY("deviation", {
  x: (_, i) => i,
  y: d => d
})).plot()
```
Control: the same code with data `[2, 2, null]`.

### Expected
The NaN at index 2 is dropped, as `null` is in the control. Two circles render.

### Actual
Three circles render at y = 0.0 for index 0, 1 and 2 (t=1s). The NaN is drawn as 0. The test badge reads `circles rendered: 3, expected 2`.

### Control
With `[2, 2, null]`, two circles render at 0.0 for index 0 and 1. The badge reads `circles rendered: 2, expected 2` (t=1s). The control works correctly.

### Notes
- The result does not change across the recording and is still present at t=21s.
- The console shows only parser-blocking script warnings for the CDN scripts (t=0s). There are no errors.
- Suspected cause: the deviation basis takes a zero-std-dev branch for a constant series. That branch writes 0 for every index, including NaN inputs. It should leave NaN in place.

*Recorded with SceneRecap.*

This report was written by SceneRecap from a screen recording. Try SceneRecap free

Turn a screen recording into a bug report like this one.

Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.

Try SceneRecap free →
Observable Plot 0.6.19: normalizeY("deviation") renders NaN as zero for a constant series · SceneRecap