msmu.pl.plot_pca
Plot previously computed principal-component scores.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
|
required |
modality
|
str
|
Name of the modality to plot, such as |
'protein'
|
groupby
|
str | None
|
Grouping column in observation metadata (or feature metadata where supported). |
None
|
colorby
|
str | None
|
Observation column used to assign sample colors when |
None
|
template
|
str
|
Registered |
DEFAULT_TEMPLATE
|
pcs
|
tuple[int, int] | list[int]
|
Two 1-based component numbers, for example |
(1, 2)
|
obs_column
|
str | None
|
Sample identifier in |
None
|
key
|
str
|
Key containing PCA scores in modality |
'X_pca'
|
kwargs
|
str
|
Additional |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
|
Notes
Run pca first. Match key to its key_added; at least the requested components must exist. Quantification and embeddings are unchanged. Resolving an existing sample-identifier column can convert that column in mdata.obs to categorical; pass a copy to preserve its dtype.
Examples:
import msmu as mm
mdata = mm.tl.pca(mdata, modality="protein", n_components=2)
fig = mm.pl.plot_pca(mdata, modality="protein", pcs=(1, 2))
fig.show()