Skip to content

fix(stats): end box plot whiskers at observed inliers - #2033

Open
Shubham-Padkonde wants to merge 1 commit into
airbnb:masterfrom
Shubham-Padkonde:fix/boxplot-observed-whiskers
Open

Shubham-Padkonde wants to merge 1 commit into
airbnb:masterfrom
Shubham-Padkonde:fix/boxplot-observed-whiskers

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes #1731.

When a sample contains outliers, computeStats currently returns the theoretical Tukey fences as box-plot whiskers, even if no observation lies there. For [-100, 1, 2, 3, 4, 5, 6, 7, 8, 9], this produces -5.5 and 14.5 instead of 1 and 9.

Use the first and last sorted non-outlier observations for the box-plot endpoints. Reuse the observations already selected for binning; histogram bounds, bin counts, quartiles and outlier classification retain their existing behavior.

Regression coverage includes lower, upper and two-sided outliers, values exactly on the fences, input preservation and unchanged histogram bins. The three outlier cases fail on the base revision and pass with this change. The zero-IQR work in #2024 remains separate.

Validation (Windows, Node 24.15, Yarn 4.10.3):

  • All 15 @visx/stats tests passed.
  • Changed-file ESLint and Prettier passed without warnings or errors.
  • Workspace TypeScript builds across 44 packages and kernel API type check passed.
  • Vendor compilation and CommonJS/ESM package compilation passed. The top-level build's Unix find cleanup and the package helper's inline environment assignment do not run in Windows shells; I ran the remaining type checks and Babel steps directly without changing build scripts.

Prepared with Codex assistance.

This branch has not been deployed

No deployments
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.

Whisker calculation (min/max) in box plot not considering actual datapoints if there are outliers

1 participant