fix(marks): treat positional literals as coordinate channels - #2
Merged
Conversation
A bare literal on a coordinate channel (e.g. `y = 0` for a segment baseline) was classified as a constant style param, so it never landed in the layer's `values` and never trained the position scale. This collapsed each segment's start point onto its end (zero-length, invisible) and made a segment-only plot error with "Every layer needs an x and y encoding". Keep literals on the positional aesthetics (x, y, xend, yend, xmin, xmax, ymin, ymax) as constant-valued channels so they recycle per row and feed scale training, matching ggplot2's `aes(y = 0)` semantics. Also pool `xend`/`yend` in `.axis_pool()` so segment/edge endpoints extend the axis domain; previously a segment-only plot trained a degenerate domain and drew its sticks off-panel. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
A lollipop chart built with a segment baseline didn't render its sticks:
The
y = 0was silently dropped.Root cause
Two bugs, both confirmed by rendering the SVG:
.split_encodings()classified any bare literal (y = 0) as a constant style param. That's correct forsize = 3/color = "red", but a positional literal is a coordinate: it never landed in the layer'svalues, so.emit_segment()mapped the segment's start point onto its end point — every stick was zero-length and invisible — and a segment-only plot errored with "Every layer needs an x and y encoding"..axis_pool()never pooledxend/yend, so segment/edge endpoints didn't extend the axis domain. A segment-only plot trained a degenerate domain and drew its sticks far off-panel.Fix
x,y,xend,yend,xmin,xmax,ymin,ymax) as constant-valued channels, so they recycle per row and feed scale training — matching ggplot2'saes(y = 0)semantics.xend/yendin.axis_pool()so segment endpoints extend the domain like the start coordinate does.