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

The range over which offsets are spread differ between encoding channels and mark configs. #9438

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

Comments

@joelostblom
Copy link
Contributor

If I set the offset via an encoding channel, points are by default spread over the entire band:

image
Open the Chart in the Vega Editor

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

However, if I do the same thing in the mark config, the points are not at all spread as widely:

image
Open the Chart in the Vega Editor

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

If I scale the spread by a constant (e.g. random() * 15 as in #9436), the encoding channel will dynamically rescale its range and the chart looks the same as before. However, doing the same in the mark config will increase the spread of the points until they overlap with points of neighboring categories.

It's somewhat confusing that these work differently and it would be helpful if their behavior could be standardized.


The goal with #9436, #9437, and this issue is to simplify the usage of jittering, which I think is an important and often used functionality, especially for statistical and scientific charts. Ideally, I would like to be able to use the most convenient syntax:

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

and end up with an effective chart by default:
image

cc @kanitw as per the previous issues I just opened.

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