Composition line charts bridge NaN gaps (pre-existing in 0.0.8)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- numpy, python
- Domain
- data-visualization
Research direction
Start by comparing the composition line payload and rendering path with the native xy.pyplot exports, which preserve gaps; the issue provides a minimal reproduction and a 100,000-point decimation case. Trace how invalid samples are removed and how M4 decimation handles gaps, then inspect the relevant specification and news fragment. Done means direct lines and decimated lines preserve separate segments for invalid x or y values, including with clipping, zoom, and streaming append, while finite-data behavior and native pyplot gap behavior remain intact.
Written by the indexing model from the issue text.
Description
Composition line charts remove invalid samples and connect the surviving points across the missing interval. This invents continuity where the data should have a gap.
Classification: pre-existing bug, reproduced in published PyPI xy==0.0.8 and xy==0.0.9a1. This is not a regression introduced by the alpha and is tracked as a follow-up, not a blocker for the 0.0.9 release.
Reproduction
Install either published version in a clean environment:
uv venv --python 3.11 .venv
uv pip install --python .venv/bin/python 'xy==0.0.9a1'
.venv/bin/python repro.py
Save this as repro.py:
from pathlib import Path
import numpy as np
import xy
chart = xy.line_chart(
xy.line(np.arange(6), [0.0, 1.0, np.nan, np.nan, 1.0, 0.0]),
width=800,
height=420,
)
Path("gap.html").write_text(chart.to_html())
Path("gap.svg").write_text(chart.to_svg())
Path("gap.png").write_bytes(chart.to_png(scale=1))
print(xy.__version__)
print(chart.figure().build_payload()[0]["traces"])
Open the HTML in a browser and inspect the PNG/SVG. Repeat in a separate environment with xy==0.0.8.
Actual: one continuous line connects x=1 to x=4, crossing the missing x=2 and x=3 samples. The direct payload contains six input points but only four emitted marks, without preserving the gap between the surviving points.
Expected: two observed segments, x=0→1 and x=4→5, with no connecting line between them.
This contradicts design-dossier §19: Nulls, NaN, and gaps: invalid samples must create line breaks, including after decimation, while invalid values stay out of GPU buffers.
Verified scope and evidence
| Case | PyPI 0.0.8 | PyPI 0.0.9a1 |
|---|---|---|
| Composition, direct line with NaN y | Bridges gap | Bridges gap |
| Composition, direct line with NaN x | Bridges gap | Bridges gap |
| Composition, 100,000-point M4-decimated line with NaN y | Bridges gap | Bridges gap |
Equivalent native xy.pyplot SVG/PNG exports |
Preserve gaps | Preserve gaps |
For the NaN-x case, use x = np.arange(6, dtype=float); x[2:4] = np.nan and y = [0, 1, 1, 1, 1, 0].
For the decimated case:
x = np.arange(100_000, dtype=float)
y = np.ones(len(x))
y[30_000:70_000] = np.nan
chart = xy.line_chart(xy.line(x, y), width=800, height=420)
The composition SVG has one path/move in all three cases; the equivalent pyplot exports have disjoint segments. PNGs were inspected visually, and the small direct example was also confirmed in a real Chromium browser. The same problem is visible in an ordinary datetime revenue report with missing days.
Environment: Linux x86_64, CPython 3.11.15, NumPy 2.4.6, native XY core, independent PyPI installations with no editable checkout or installed-package patches. Browser confirmation used Chromium with software WebGL.
Acceptance criteria
- Preserve gap boundaries for invalid x or y samples in direct line payloads.
- Preserve boundaries through M4 decimation; buckets must not span missing intervals.
- Browser, PNG, and SVG show separate observed segments without NaNs in GPU buffers.
- Cover multiple gaps, clipping/zoom, and streaming append while preserving finite-data behavior.
- Keep native pyplot gap behavior intact and update the relevant specification and news fragment with the fix.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 79
- Avg merge
- 1d 39m
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reflex-dev/xy
-
Skip finite/log visibility scans when zone maps already prove all-finite on linear axesMay be free again A pull request for this issue was closed without being merged. Openneeds investigate performance
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
reflex-dev/xy#169 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
reflex-dev/xy#552 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
reflex-dev/xy#551 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
reflex-dev/xy#550 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
reflex-dev/xy#523 ·
Maintainers usually reply within 1 day
Similar issues
-
release
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
MichaelYcJo/SpecSeal#1535 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
valentinfrlch/ha-llmvision#769 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
daniel-ospina/tortoise#11937 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue help wanted python up-for-grabs
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
andrewsiah/agentswarm-data-tasks#238 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
cadence-workflow/cadence-ai-samples#175 ·
Maintainers usually reply within 1 day