I originally opened an issue for this in the Vega repo https://github.com/vega/vega/issues/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:
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?
I would like to distribute points in the shape of a density / violin cloud as in this picture Python code and Vega-Lite spec in this comment
I originally opened an issue for this in the Vega repo https://github.com/vega/vega/issues/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:
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 https://github.com/vega/vega-lite/issues/4703#issuecomment-927257382