Skip to content

Intervals for binning #734

Closed
Closed
@mbostock

Description

@mbostock

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions