Skip to content

Skip table fallback when coloring by element DataFrame column#571

Merged
timtreis merged 3 commits intomainfrom
fix/issue-562-spurious-table-warning
Mar 31, 2026
Merged

Skip table fallback when coloring by element DataFrame column#571
timtreis merged 3 commits intomainfrom
fix/issue-562-spurious-table-warning

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented Mar 31, 2026

Summary

  • Fixes Warning being triggered then coloring points by column in points df #562 — spurious "No table name provided, using 'X' as fallback for color mapping" warning when coloring points/shapes by a categorical column in the element's own DataFrame
  • When _locate_value determines the color column lives on the element (origin="df"), the table lookup for .uns colors is now skipped entirely
  • Adds regression test with multi-table SpatialData confirming no warning is emitted

timtreis and others added 2 commits March 31, 2026 12:12
When `_locate_value` determines the color column lives on the element's
own DataFrame (origin="df"), skip the table lookup entirely. This avoids
a spurious "No table name provided, using X as fallback" warning when
multiple tables exist but the color data doesn't come from any of them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove redundant len(origins) == 1 guard (already inside that branch)
- Pass table_to_use (not table_name) to _has_colors_in_uns and
  _extract_colors_from_table_uns so that element-origin values don't
  accidentally pick up .uns colors from an unrelated table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.19%. Comparing base (367204d) to head (5f33729).

Files with missing lines Patch % Lines
src/spatialdata_plot/pl/utils.py 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #571      +/-   ##
==========================================
- Coverage   75.61%   75.19%   -0.43%     
==========================================
  Files          10       10              
  Lines        2908     2911       +3     
  Branches      672      673       +1     
==========================================
- Hits         2199     2189      -10     
- Misses        428      443      +15     
+ Partials      281      279       -2     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/utils.py 65.40% <80.00%> (-0.78%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

When no table is resolved (element-origin, no tables, or user-specified
table not found), skip the .uns color lookup entirely rather than
scanning all tables with table_name=None.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timtreis timtreis merged commit 5868f14 into main Mar 31, 2026
8 checks passed
@timtreis timtreis deleted the fix/issue-562-spurious-table-warning branch March 31, 2026 11:37
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.

Warning being triggered then coloring points by column in points df

2 participants