Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offset via encoding channels are centered at the ranges midpoint whereas offset in marks are centered at 0 #9436

Open
joelostblom opened this issue Sep 20, 2024 · 0 comments
Labels

Comments

@joelostblom
Copy link
Contributor

If I set a random jitter via an encoding channel, the points will be centered in the band and jittered around the midpoint/tickmark as desired:

image
Open the Chart in the Vega Editor

    ...
    "yOffset": {"field": "random", "type": "quantitative"},
  ...
  "transform": [{"calculate": "random() * 15", "as": "random"}],

However, if I do the same thing in the mark config, the points are no longer jittered around a midpoint, but instead just in one direction ("down" in this screenshot), so that they are misaligned with the ticks on the y-axis:

image
Open the Chart in the Vega Editor

  "mark": {"type": "point", "yOffset": {"expr": "random() * 15"}},

This latter behavior is undesirable and it would be great if setting the offset in the mark config was centered just as when setting it via the encoding channel. Looking at the Vega spec, it seems that the mark uses a "point" scale whereas the encoding channel uses a "band" scale, but simple changing that did not fix the issue.

cc @kanitw since you implemented #7684 and might know best what is going on (I will tag you in a few offset related issues)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant