scdef.pl.path_embedding ¶
path_embedding(model: scDEF, path_id: Union[int, str] = 'auto', paths_key: str = 'transition_paths', score_key: Optional[str] = None, basis: str = 'umap_multilayer', min_affinity: float = 0.0, affinity_alpha_range: Tuple[float, float] = (0.15, 1.0), cmap: str = 'viridis', point_size: float = 10.0, show_background: bool = True, background_color: str = 'lightgray', background_alpha: float = 0.2, obs_key: Optional[str] = None, obs_order: Optional[Sequence[str]] = None, ncols: int = 3, ax: Optional[Axes] = None, show: bool = True) -> Optional[Figure]
Plot cells on an embedding colored by position along one path.
This visualization uses outputs from scd.tl.score_paths:
- adata.obsm[f"{score_key}_positions"]
- adata.obsm[f"{score_key}_affinities"].
Color encodes path position (0->1), and point alpha scales with
path affinity. If obs_key is provided, draws one facet per
category value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
scDEF
|
fitted scDEF model scored by |
required |
path_id
|
Union[int, str]
|
which path to draw, as an index or a stored path name. |
'auto'
|
paths_key
|
str
|
|
'transition_paths'
|
score_key
|
Optional[str]
|
prefix of the |
None
|
basis
|
str
|
|
'umap_multilayer'
|
min_affinity
|
float
|
hide cells whose affinity for the path falls below this, so the plot shows only cells the path actually describes. |
0.0
|
affinity_alpha_range
|
Tuple[float, float]
|
opacity range mapped from affinity, as
|
(0.15, 1.0)
|
cmap
|
str
|
colormap for path position. |
'viridis'
|
point_size
|
float
|
marker size for the plotted cells. |
10.0
|
show_background
|
bool
|
draw the cells that are not on the path underneath, for context. |
True
|
background_color
|
str
|
color of those background cells. |
'lightgray'
|
background_alpha
|
float
|
opacity of those background cells. |
0.2
|
obs_key
|
Optional[str]
|
|
None
|
obs_order
|
Optional[Sequence[str]]
|
order of the facets. Defaults to the category order. |
None
|
ncols
|
int
|
number of facet columns. |
3
|
ax
|
Optional[Axes]
|
existing axes to draw into. Only valid when not faceting. |
None
|
show
|
bool
|
call |
True
|
Returns:
| Type | Description |
|---|---|
Optional[Figure]
|
The figure when |