Add native zero-inclusive symlog axis scale#109
Open
FarhanAliRaza wants to merge 2 commits into
Open
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.
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