nan handling for continuous and categorical coloring#427
nan handling for continuous and categorical coloring#427Sonja-Stockhaus wants to merge 31 commits intomainfrom
Conversation
…ints/shapes separately before colored
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #427 +/- ##
==========================================
- Coverage 83.75% 83.02% -0.73%
==========================================
Files 8 8
Lines 2555 2681 +126
==========================================
+ Hits 2140 2226 +86
- Misses 415 455 +40
🚀 New features to boost your workflow:
|
| if np.any(color_source_vector.isna()): | ||
| cell_id[color_source_vector.isna()] = 0 |
There was a problem hiding this comment.
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
|
Hi @timtreis, just wondering what the status of this is, is there a reason why this hasn't been merged yet? I constantly run into this issue, so this would be a very useful thing to have in the package. |
|
Hey @MeyerBender, sorry, will resolve the merge conflicts and get it released today :) |
|
@MeyerBender, there's an edge case that I haven't figured out how to solve yet. Will be a bit delayed |
|
@MeyerBender can you try this branch? |
|
@timtreis Thanks a lot for your efforts! Just tried it on one of my datasets containing NAs and it worked flawlessly. |
|
Great! I discovered two other minor but related issue/inconsistencies which are also fixed in this. I'll have to clean it up a bit but should be out next week. Feel free to give code review if you feel comfortable doing so. |
|
Sounds great, happy to have a look |
|
@MeyerBender did you already have the chance? |
|
Sorry, I assumed you were still cleaning up stuff but if not I can get around to it tomorrow |
|
|
||
| if continuous_nan_shapes is not None: | ||
| # for coloring by continuous variable: render nan shapes separately | ||
| nan_color_hex = render_params.cmap_params.na_color.get_hex() |
There was a problem hiding this comment.
I like defaulting to a gray color, but there are some use cases where users might want to use a custom color for NAs. Would be cool to either have this as an extra argument (na_color), or make it possible to pass in palette.
Fix coloring of shapes, labels and points when there are nan values in the vectors to color by