Skip to content

Support channels_as_legend for single-channel and sequential renders#641

Merged
timtreis merged 6 commits intomainfrom
fix/issue-601-channels-as-legend-single-channel
May 7, 2026
Merged

Support channels_as_legend for single-channel and sequential renders#641
timtreis merged 6 commits intomainfrom
fix/issue-601-channels-as-legend-single-channel

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 7, 2026

Summary

  • channels_as_legend=True was only applied in the multi-channel composite code path; single-channel renders and sequential multi-render workflows silently produced no legend
  • Single-channel path now collects a legend entry using the colormap color at cmap(0.75) — the same representative point used for the colorbar
  • RGB (true-color, 3-channel uint8) path emits a warning that channels_as_legend is not supported and is ignored, rather than silently doing nothing

Closes #601

timtreis added 2 commits May 7, 2026 18:43
…601)

The channels_as_legend block was only reached by the multi-channel else
branch. The single-channel path now collects a legend entry using the
channel color sampled from the cmap at 0.75. The RGB early-return path
emits a warning since per-channel colors are not meaningful there.

Sequential single-channel renders (e.g. DAPI then GFP) are fixed for
free: each call appends its entry to channel_legend_entries.
… and visual tests for single-channel channels_as_legend
@timtreis timtreis changed the title Support channels_as_legend for single-channel and sequential renders (#601) Support channels_as_legend for single-channel and sequential renders May 7, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.41%. Comparing base (e1f8863) to head (1c37fd7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #641      +/-   ##
==========================================
+ Coverage   76.39%   76.41%   +0.01%     
==========================================
  Files          11       11              
  Lines        3237     3239       +2     
  Branches      759      761       +2     
==========================================
+ Hits         2473     2475       +2     
  Misses        466      466              
  Partials      298      298              
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 86.67% <100.00%> (+0.08%) ⬆️

... and 1 file with indirect coverage changes

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

@timtreis timtreis merged commit 49acff0 into main May 7, 2026
7 of 8 checks passed
@timtreis timtreis deleted the fix/issue-601-channels-as-legend-single-channel branch May 7, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

channels_as_legend=True silently ignored for single-channel and sequential renders

2 participants