Skip to content

Cap discrete OOB PMF bars with a y-axis break marker - #5122

Draft
lsabor wants to merge 2 commits into
mainfrom
claude/issue-5117-for-discrete-questions-make-y
Draft

Cap discrete OOB PMF bars with a y-axis break marker#5122
lsabor wants to merge 2 commits into
mainfrom
claude/issue-5117-for-discrete-questions-make-y

Conversation

@lsabor

@lsabor lsabor commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #5117

Summary

For discrete questions, when a below-lower-bound or above-upper-bound PMF bar far exceeds the tallest in-bounds bar, the whole in-bounds distribution gets visually squashed. This PR clamps OOB bars at OOB_BAR_DISPLAY_RATIO * inbound max (default = 2) and renders a zigzag axis-break marker on top, with the true PMF value labelled above the break.

Test plan

  • Open a discrete question whose community forecast puts >> inbound-max mass on an OOB bin and confirm the in-bounds shape is preserved
  • Confirm the break marker renders on the clamped bar with the true % above it
  • Discrete questions with small or no OOB mass still render unchanged
  • Continuous / date / numeric charts unaffected

Generated with Claude Code

When a discrete question forecast has a below-lower-bound or above-upper-bound
mass that far exceeds the tallest in-bounds bar, the entire in-bounds
distribution gets visually squashed. Clamp OOB bar heights in the PMF chart
at OOB_BAR_DISPLAY_RATIO (=2) times the tallest in-bounds bar and draw a
zigzag axis-break marker on top of any clamped bar, with the true PMF value
labeled above the break.

Fixes #5117

Co-authored-by: Luke Sabor <32885230+lsabor@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7104c594-c122-4919-bb16-4cd6963ec39d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-5122-claude-issue-5117-for-discrete-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-5117-for-discrete-questions-make-y-a8ec4a5
🗄️ PostgreSQL NeonDB branch preview/pr-5122-claude-issue-5117-for-discrete
Redis Fly Redis mtc-redis-pr-5122-claude-issue-5117-for-discrete

Details

  • Commit: a8ec4a564fd48465eb915412ea6327a28e6c65cc
  • Branch: claude/issue-5117-for-discrete-questions-make-y
  • Fly App: metaculus-pr-5122-claude-issue-5117-for-discrete

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

The axis-break marker for out-of-bounds discrete PMF bars never rendered:
the bar's clamp cap and the Y-axis domain top used different, unrelated
multipliers of the in-bounds max, so a clamped bar (and its marker) always
extended past the visible plot and got clipped by the SVG viewport.

Unifies the axis top and clamp cap into a single value, and reworks the
break itself: instead of an overlaid color patch (which either mismatched
the real background or clipped off-canvas), the OOB bar's own path is drawn
with a real gap — a literal hole punched out with diagonal cut edges,
anchored just above the tallest in-bounds bar, so the removed segment truly
shows the page background through it. The axis also reserves extra headroom
and hides regular tick labels above the break, leaving only the bar's true
value annotated there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lsabor

lsabor commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author
image

@lsabor

lsabor commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Before

image

After

image

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.

For discrete questions, make y axis label breakable

1 participant