Skip to content

Intervals for binning #734

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

Closed
mbostock opened this issue Feb 3, 2022 · 0 comments · Fixed by #735
Closed

Intervals for binning #734

mbostock opened this issue Feb 3, 2022 · 0 comments · Fixed by #735
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

mbostock commented Feb 3, 2022

When you have data with a certain regularity, e.g. integers, it’d be nice if you could indicate that to the bin transform. This would allow it to “nice” the domain to contain that interval, and compute the appropriate thresholds. For example, say you have hourly data, you might want to specify the interval option instead of thresholds:

Plot.plot({
  marks: [
    Plot.rectY(data, Plot.binX({y: "count"}, {
      x: d => d.timestamp.getHours(),
      domain: [0, 24],
      interval: 1
    })),
    Plot.ruleY([0])
  ]
})

Previously #733.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant