Skip to content

feat: add support for single-color colormaps with constant mapping behavior#140

Open
tlambert03 wants to merge 1 commit into
pyapp-kit:mainfrom
tlambert03:single-color
Open

feat: add support for single-color colormaps with constant mapping behavior#140
tlambert03 wants to merge 1 commit into
pyapp-kit:mainfrom
tlambert03:single-color

Conversation

@tlambert03
Copy link
Copy Markdown
Member

closes #139

hey @aafkegros, here's one possible fix to #139. Let me know how this would work for you. And again, still happy to iterate on this

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.56%. Comparing base (954b1ca) to head (eedc86c).

Files with missing lines Patch % Lines
src/cmap/_colormap.py 83.33% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (83.33%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
- Coverage   95.56%   93.56%   -2.00%     
==========================================
  Files         168      168              
  Lines        2186     2191       +5     
==========================================
- Hits         2089     2050      -39     
- Misses         97      141      +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aafkegros
Copy link
Copy Markdown
Contributor

I think this is a valid solution to solve that the single-valued colormap did not return a constant-valued map. However, l do think it's introducing more exceptions to the Colormap model than allowing single-valued colormaps would.

Given that the interpolation at calling behaviour would also work for a single valued color, and that would avoid inserting a new value and throwing away the color stop.

I can open a PR for my envisioned solution, but it will take a bit of time as I'm a bit busy in other tasks 😅

@tlambert03
Copy link
Copy Markdown
Member Author

Sure, I'd be happy to see it. No hurry (as long as you're not in a hurry for a fix! 😃)

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.

Single-color colormaps add an extra value

2 participants