observablehq / observablehq/plot
The map transform should maybe apply maybeApplyInterval?
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
The map transform groups by y and not by intervaled y. If you replace y: (d) => ((d.height * 10) | 0) / 10 below by y: "height", the box plot shows too many outliers (the outliers are using a map transform).
Here's a test with the correct outliers:
export async function boxplotXInterval() {
const olympians = await d3.csv<any>("data/athletes.csv", d3.autoType);
return Plot.plot({
y: {interval: 0.1, reverse: true},
marks: [
Plot.boxX(
olympians.filter((d) => d.height),
{x: "weight", y: "height", z: (d) => Math.floor(d.height * 10)}
)
]
});
}
now, remove the z specified above, and you get this incorrect chart, where you have "outliers" inside the q1-q3 band:
(excerpted from #1839; note that I've updated the code slightly to add y: {reverse: true}, for when we create the actual unit test.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the map transform and maybeApplyInterval behavior used by Plot.boxX, then compare it with the boxplotXInterval example in the issue. Add or update the unit test using the athletes data and verify that intervaled y grouping produces the correct outliers without explicitly supplying z.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3, javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100