Skip to content

Scatter view collapses to a horizontal line after repeated box-zoom + zoom-out #87

Description

@Darksinian

Summary

On an interactive scatter chart in a Jupyter notebook, doing a box zoom ~3 times in a row and then zooming out corrupts the view transform: the axis scale goes completely wrong and the point cloud collapses into a horizontal line. The chart does not recover a sane domain on zoom-out.

Repro

Rendered in a notebook (playground.ipynb, editable install of main @ 541a7da):

import numpy as np
import xy
from IPython.display import display

rng = np.random.default_rng(42)
m2 = 20_000
sx = rng.normal(0, 1, m2)
sy = sx * 0.5 + rng.normal(0, 0.6, m2)
cvals = sx**2 + sy**2
svals = np.abs(rng.normal(size=m2))

display(
    xy.scatter_chart(
        xy.scatter(x=sx, y=sy, color=cvals, size=svals, colormap="viridis", size_range=(3, 18), opacity=0.7),
        title="xy — 20k scatter, color + size encoded",
        width=900,
        height=340,
    )
)

Steps:

  1. Render the chart above.
  2. Box-zoom into the data three times in succession (progressively deeper).
  3. Zoom out.

Actual: the scale is completely wrong after the zoom-out; the scatter shrinks/flattens to a horizontal line.

Expected: zooming out walks back to a sane domain; the aspect/scale of the data is preserved at every step.

Notes

  • Suspect the accumulated view-transform math on repeated box zooms — possibly the f32 offset re-centering path (dossier §16) or domain bookkeeping in js/src/53_interaction.js (box zoom vs. center-anchored zoom-out).
  • The y-domain collapsing to ~zero height ("horizontal line") suggests a degenerate domain is being computed on the zoom-out step rather than inverting the prior box zooms.

Environment: Linux, Chromium-based browser, Jupyter notebook, xy editable install of main @ 541a7da (native kernel backend).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions