This message was deleted.
# help
s
This message was deleted.
💖 1
❤️ 5
t
brainstorming out loud, this might be a hacky solution, in the end i used Math.random to add a jitter effect
m
If it helps, here is a skeletal approach of how I might do this. (I didn’t attempt to reproduce your aesthetics, just the basic structure with marks.) I used the dodgeY transform for the beeswarm in conjunction with faceting. https://observablehq.com/d/a26e34c1902de423
🙌 1
🙏 1
For the jitter, I did a fancy version of this idea
Copy code
x: (d) => d.rating + Math.random() - 0.5
except I wrote it as a
jitter
helper so that I could use a seeded random number generator so that it always produces the same result, like so:
Copy code
function jitter(value, radius) {
  return {
    transform(data) {
      const source = d3.randomLcg(42); // seeded random for determinism
      const random = d3.randomUniform.source(source)(-radius, radius);
      return Plot.valueof(data, value, Float64Array).map((x) => x + random());
    }
  };
}
We could definitely add a jitter (jitterX, jitterY maybe?) transform to make this a little easier. I’ll file a feature request for that.
Faceting seemed to work pretty well, so I’m curious if there are still reasons why it wouldn’t work for you here? The most awkward part in my experience was that I had to calculate the overall average rating for the ruleY mark that connects the average per-doctor to the overall average. Also, I first tried to use the link and arrow mark for that, but we don’t allow them to be one-dimensional currently. I filed a feature request for that too!
Also, thank you so much for sharing your work in progress like this! Whenever you share it spawns like a half-dozen feature request ideas for Plot and helps us ground what we build next! 🙏
❤️ 3
t
thank you @Mike Bostock! really appreciate you digging into the code to give some ideas on how to do it. really slick tricks with the facet, a lot more straightforward than what i cooked up 😆 ps the new Observable Plot site is really handy, learning a lot as I go thru some of these ideas (search feature is 🔥)
❤️ 1