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

rank, quantile #570

Merged
merged 4 commits into from
Oct 1, 2021
Merged

rank, quantile #570

merged 4 commits into from
Oct 1, 2021

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Oct 1, 2021

Screen Shot 2021-10-01 at 8 26 30 AM

{
  const randomNormal = d3.randomNormal.source(d3.randomLcg(42))();
  const randoms = Array.from({length: 300}, randomNormal);
  return Plot.plot({
    marks: [
      Plot.dotX(randoms, Plot.mapY("quantile", {y: randoms}))
    ]
  });
}

@Fil
Copy link
Contributor

Fil commented Oct 1, 2021

Cool :)

We already had
Plot.dotX(d3.sort(randoms), { y: (d, i) => i / (randoms.length - 1) }).plot()

but this is obviously nicer since it doesn't need to re-order the data (facets!), and knows what to do with NaNs.

@mbostock mbostock merged commit ec55d5e into main Oct 1, 2021
@mbostock mbostock deleted the mbostock/rank branch October 1, 2021 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants