Skip to content

uniform color handling between labels and points/shapes#497

Open
Sonja-Stockhaus wants to merge 4 commits intomainfrom
feature/refactor_label_color_handling
Open

uniform color handling between labels and points/shapes#497
Sonja-Stockhaus wants to merge 4 commits intomainfrom
feature/refactor_label_color_handling

Conversation

@Sonja-Stockhaus
Copy link
Collaborator

As mentioned in #478, here we adapt the color handling of labels so that it works the same way as points/shapes (e.g. you can pass any color like...)

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.83%. Comparing base (d22d3b8) to head (e8a940e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
+ Coverage   83.80%   83.83%   +0.03%     
==========================================
  Files           8        8              
  Lines        1976     1980       +4     
==========================================
+ Hits         1656     1660       +4     
  Misses        320      320              
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/basic.py 89.32% <100.00%> (ø)
src/spatialdata_plot/pl/render.py 92.51% <100.00%> (ø)
src/spatialdata_plot/pl/render_params.py 89.20% <100.00%> (+0.06%) ⬆️
src/spatialdata_plot/pl/utils.py 78.37% <100.00%> (+0.05%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis marked this pull request as ready for review October 20, 2025 16:47
@timtreis timtreis force-pushed the feature/refactor_label_color_handling branch 2 times, most recently from 3542f6b to 6338980 Compare February 27, 2026 22:18
…lor='red'`

Labels now use the same color/col_for_color split as shapes and points,
so `render_labels(color="red")` is correctly recognized as a literal
color instead of being treated as a column name. Fixes #470 and #478.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@timtreis timtreis force-pushed the feature/refactor_label_color_handling branch from 6338980 to c31d2e9 Compare March 5, 2026 21:40
timtreis and others added 3 commits March 5, 2026 22:46
- Use `is not None` instead of truthiness check, matching shapes/points
- Pass overridden na_color to _map_color_seg so labels not in the table
  respect the literal color when one is set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When color is a literal value (not a column name), the groups parameter
has no effect. Added a warning for labels, points, and shapes so users
aren't silently confused.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract duplicated groups-ignored warning string to _GROUPS_IGNORED_WARNING
- Add col_for_color guard to na_color override, matching the points pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants