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

Add jittering in the shape of a density/KDE for point marks #8067

Open
joelostblom opened this issue Mar 25, 2022 · 2 comments
Open

Add jittering in the shape of a density/KDE for point marks #8067

joelostblom opened this issue Mar 25, 2022 · 2 comments

Comments

@joelostblom
Copy link
Contributor

joelostblom commented Mar 25, 2022

I would like to distribute points in the shape of a density / violin cloud as in this picture
image
Python code and Vega-Lite spec in this comment

I originally opened an issue for this in the Vega repo vega/vega#3311 because I wasn't sure whether it was yet possible in Vega. I just heard back from jheer that it is actually possible to create this in Vega. Please refer to that issue for more details, but in brief this is what he said:

Here is an implementation in Vega.

The approach taken is:

  • Compute the density, and generate a rounded value to serve as a lookup key.
  • For the original points, bin the data in a manner that matches the density samples.
  • Extend the original points by performing a lookup against the density values.
  • Use the density values to scale the random jitter.

This works in Vega, but I don't think it can be expressed in Vega-Lite or Altair because the secondary data input to the lookup transform does not allow additional transforms to be applied.

Would it be possible to support this Vega expression in Vega-Lite by addressing the last comment in the quote above? Would this require a major or minor change in Vega-Lite?

cc: @kanitw since we talked about this a little in #4703 (comment)

@domoritz
Copy link
Member

I think it would be great to support additional transforms in lookup. I remember that there were similar requests in the past.

@hcoohb
Copy link

hcoohb commented Jul 15, 2022

That would be an awesome feature indeed!

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

No branches or pull requests

3 participants