Skip to content

nan handling for continuous and categorical coloring #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Sonja-Stockhaus
Copy link
Collaborator

Fix coloring of shapes, labels and points when there are nan values in the vectors to color by

@Sonja-Stockhaus Sonja-Stockhaus linked an issue Mar 5, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.32%. Comparing base (667f430) to head (82d6d49).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #427      +/-   ##
==========================================
+ Coverage   84.92%   85.32%   +0.40%     
==========================================
  Files           8        8              
  Lines        1784     1820      +36     
==========================================
+ Hits         1515     1553      +38     
+ Misses        269      267       -2     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 97.14% <100.00%> (+0.76%) ⬆️
src/spatialdata_plot/pl/utils.py 78.25% <100.00%> (+0.06%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sonja-Stockhaus Sonja-Stockhaus marked this pull request as ready for review March 26, 2025 17:18
Comment on lines -822 to -823
if np.any(color_source_vector.isna()):
cell_id[color_source_vector.isna()] = 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In seg, the value 0 depicts the background, so this would lead to the bg being mapped to the NaN color
The actual label(s) with na in the color_source_vector don't have their id in cell_id anymore, so they're mapped to nothing! => would look like background

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.

Categorical color obs column crashes the plotting
2 participants