Skip to content

Commit 9069571

Browse files
author
Philipp Weiler
authored
Update state plotting (#1177)
* Update `TermStatesEstimator::_plot_discrete` Add outline if plotted in the same plot. * Update ground truth figures Update ground truth figures for unit tests using new API.
1 parent 4ae88b9 commit 9069571

19 files changed

+6
-0
lines changed

src/cellrank/estimators/terminal_states/_term_states_estimator.py

+6
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,15 @@ def _plot_discrete(
440440
# fmt: off
441441
with RandomKeys(self.adata, n=1 if same_plot else len(states), where="obs") as keys:
442442
if same_plot:
443+
outline = _data.cat.categories.to_list()
444+
_data = _data.cat.add_categories(["nan"]).fillna("nan")
445+
states.append("nan")
446+
color_mapper["nan"] = "#dedede"
443447
self.adata.obs[keys[0]] = _data
444448
self.adata.uns[f"{keys[0]}_colors"] = [color_mapper[name] for name in states]
445449
title = _title if title is None else title
446450
else:
451+
outline = None
447452
for key, cat in zip(keys, states):
448453
self.adata.obs[key] = _data.cat.set_categories([cat])
449454
self.adata.uns[f"{key}_colors"] = [color_mapper[cat]]
@@ -456,6 +461,7 @@ def _plot_discrete(
456461
self.adata,
457462
color=color + keys,
458463
title=color + title,
464+
add_outline=outline,
459465
**kwargs,
460466
)
461467
# fmt: on
584 Bytes
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)