Composition line charts bridge NaN gaps (pre-existing in 0.0.8)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 57/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- numpy, python
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 1.9k
- 派生
- 79
- 平均合并
- 1 天 39 分钟
- 30 天内合并 PR
- 22
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
reflex-dev/xy 的其他 Issue
-
Skip finite/log visibility scans when zone maps already prove all-finite on linear axes可能重新可做 关联的 PR 已关闭且未合并。 未关闭needs investigate performance
难度 2/5 1-3 小时 新手友好度 76/100
reflex-dev/xy#169 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
reflex-dev/xy#552 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
reflex-dev/xy#551 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
reflex-dev/xy#550 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
reflex-dev/xy#523 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
UKGovernmentBEIS/inspect_ai#6512 ·
维护者通常 1 天内回复
-
area/c++ area/core kind/bug-report
难度 2/5 1-3 小时 新手友好度 78/100
tensorflow/quantum#1140 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
Kav-K/GPTDiscord#501 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
UKGovernmentBEIS/inspect_evals#2863 · 1 条评论 ·
维护者通常 1 天内回复