Add native zero-inclusive symlog axis scale#109
Merged
FarhanAliRaza merged 7 commits intoJul 22, 2026
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Contributor
Author
Alek99
reviewed
Jul 20, 2026
Alek99
left a comment
Member
There was a problem hiding this comment.
Review findings:
- [P1]
js/src/40_gl.js:76-78: symlog is applied after decoding offset-encoded f32 coordinates. Withx=[0, 1, 1e12]andconstant=1, 0 and 1 collapse to the same decoded value even though symlog should visibly separate them. Encode geometry in scale coordinates or retain sufficient precision before the transform. - [P1]
js/src/40_gl.js:348: density aggregation remains uniform in raw data space. Clusters at x=1 and x=1000 can land in the same raw grid cell even though they are far apart in symlog display space. Bin/decimate in scale coordinates. - [P2]
python/xy/_svg.py:2260: static heatmap/density grids are stretched only between transformed endpoints, so internal cells are not symlog-transformed. PNG follows the same pattern. - [P2]
python/xy/_figure.py:993:scale="symlog"changes renderer semantics but the protocol remains 3; an older client will silently treat it as linear. Bump the protocol and regenerate bundles.
Greptile SummaryThis PR adds a native symmetric-logarithmic axis for zero-inclusive, long-tailed data. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Reviews (5): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
…ive-long-tail-axis-scale # Conflicts: # examples/demo-advance.ipynb # js/src/40_gl.ts # js/src/50_chartview.ts # python/xy/static/index.js # python/xy/static/standalone.js
…e v5 Review fixes for the native symlog axis (#83): - Pin the f32 encode offset to 0.0 on log-family axes. A midpoint offset makes the f32 error absolute (~span/1e7), collapsing exactly the near-zero values symlog exists to separate (x=0 and x=1 encoded to the same word on a 1e12 domain); offset 0 keeps the error relative, which the transform maps to a sub-pixel coordinate error at every magnitude. - Aggregate in scale coordinates on nonlinear axes: density grids and M4 buckets bin transformed values so every cell covers a uniform strip of screen, and the drill handoff's local density matches. The raw-space tile pyramid cannot compose such grids, so those traces always take the exact scan. - Static exports: density images are scale-coordinate-uniform (linear stretch between transformed endpoints is exact); data-uniform heatmap grids resample per pixel through the inverse transform in SVG/PNG, and the WebGL heatmap shader inverts per fragment. - Bump the renderer protocol to 5 so a cached pre-symlog client refuses the spec loudly instead of silently rendering symlog as linear. - Numeric format grammar accepts literal affixes ("$,.0f" -> "$14,741"), the form issue #83's API example and the docs already use. - Resolve the pyplot shim's ty diagnostics at the type boundary instead of suppressing them. Specs updated in lockstep (dossier 16/28, wire-protocol, lod architecture, styling, chart grammar); adds the symlog demo notebook.
Both branches had bumped the wire protocol 4->5 independently (main: streaming append contract; this branch: symlog scale). Resolved by keeping main's v5 and re-bumping the symlog/scale-space additions to v6 in config.py, 00_header.ts, and spec/design/wire-protocol.md, then regenerating the minified static bundles with node js/build.mjs.
…ive-long-tail-axis-scale # Conflicts: # python/xy/static/index.js # python/xy/static/standalone.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Motivation
logaxis cannot represent while alinearaxis compresses the tail, so a zero-inclusive long-tail scale (symmetric log /symlog) is needed.Description
symlogas an accepted axistype_and aconstantparameter tox_axis()/y_axis()andFigure.set_axis()to configure the linear region width around zero, including validation of a positive constant. (python/xy/components.py,python/xy/_figure.py)scale: "symlog"andconstantinto axis payloads and ensureFigure._axis_specemitsscale/constantwhile preserving existing semantics forlinear/log. (python/xy/_figure.py)_Scaleand tick generation that produce ticks in original data units (including zero). (python/xy/_svg.py)symlogthrough the browser-side code: addsymlogbranch toaxismapping, implement JS coordinate transform and inverse, propagate a per-axisconstantuniform into GLSL, and update shader map/calls so WebGL rendering, density, hit/pick, and interaction layers operate using the symlog transform consistently. (python/xy/static/index.js,python/xy/static/standalone.js)docs/core-concepts/axes-and-scales.md,tests/test_symlog_axis.py)Testing
PYTHONPATH=python python -m pytest tests/test_symlog_axis.py -q(8 passed) andPYTHONPATH=python python -m pytest tests/test_figure.py tests/test_svg_export.py tests/test_png_export.py -q(212 passed, 1 skipped), andPYTHONPATH=python python -m pytest tests/test_components.py -q(76 passed).node --check python/xy/static/index.jsandnode --check python/xy/static/standalone.jsandgit diff --checkreported no issues.Closes #83