Skip to content

Fix under-color endpoint reservation in discrete normalization - #863

Merged
cvanelteren merged 1 commit into
mainfrom
fix/862-under-color-normalization
Nov 16, 2026
Merged

cvanelteren merged 1 commit into
mainfrom
fix/862-under-color-normalization

Conversation

@cvanelteren

Copy link
Copy Markdown
Collaborator

Setting a custom under-color on a continuous colormap disabled the wrong endpoint reservation during discrete normalization. With extend='both', this changed the upper normal bands and made the highest band identical to the over-range color.

Correct the under-only branch so that a custom under-color frees the lower endpoint while keeping the automatic upper extension distinct. Cover extend='min', 'max', 'both', and 'neither' with 64 regression cases across filled contours, color meshes, continuous and perceptual colormaps, and custom under/over combinations.

This preserves UltraPlot's existing policy of resampling normal bands to use palette endpoints freed by custom extremes. Exact preservation of every in-range color can be obtained by setting the colormap on the returned mappable after plotting.

Validation in ultraplot-dev with Matplotlib 3.11.2

  • Twelve new regression cases failed before the fix, and all 64 pass afterward.
  • Focused plotting, colormap, normalization, and colorbar tests passed with 393 passed and 2 skipped.
  • Black and git diff --check pass.
  • Rendered and inspected before/after PNGs. Verified that changing the returned mappable's colormap preserves all in-range and over-range face colors exactly.

Fixes #862.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cvanelteren

Copy link
Copy Markdown
Collaborator Author

Failures is fine and weird. Merging.

@cvanelteren
cvanelteren merged commit aff3f19 into main Nov 16, 2026
21 of 22 checks passed
@cvanelteren
cvanelteren deleted the fix/862-under-color-normalization branch November 16, 2026 08:59
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.

set_under() distorts the entire in-range colormap gradient, not just out-of-bounds extreme colors

1 participant

⌂ Proxy