structboost.plot_dimension_correlation¶
- structboost.plot_dimension_correlation(adata, *, dims=None, method='pearson', absolute=False, latent_key='X_bae', annotate=None, cmap=None, figsize=None, dpi=150)[source]¶
Heatmap of the correlation between latent dimensions.
Whether two dimensions are near-duplicates decides whether they can be read as two findings or one, and nothing else in the readout answers it – every other panel looks at one dimension at a time.
It matters most when the fit does not enforce separation:
BAEConfigdefaultsdisentanglementto"orthogonal", and a fit that turns it off can carry two dimensions describing the same programme with nothing else flagging it.- Parameters:
adata – AnnData with a fitted BAE, or an
(n_cells, n_dims)array of scores.dims (Sequence[int] | None) – Dimensions to include.
Noneuses all.method (Literal['pearson', 'spearman']) –
"pearson"(default) or"spearman". Spearman is computed as Pearson on tie-averaged ranks, which matters here: a sparse encoder leaves many cells at exactly zero on a subgroup dimension.absolute (bool) – Plot
|r|instead ofr. Signed values get a diverging map centred on zero, because the sign of a correlation is meaningful and a latent dimension’s own sign is arbitrary; absolute values are a magnitude and get a sequential one.annotate (bool | None) – Write each value into its cell.
Noneannotates when there are at most 12 dimensions, beyond which the numbers stop fitting.cmap – Override the colour map chosen by
absolute.figsize (tuple[float, float] | None) – Overrides for the computed size, and the figure’s resolution.
dpi (int) – Overrides for the computed size, and the figure’s resolution.
latent_key (str)
- Returns:
fig, ax
- Raises:
KeyError – If
latent_keyis missing from an AnnData input.ValueError – If
dimsis out of range ormethodis unknown.
Examples
>>> plot_dimension_correlation(adata, method="spearman") >>> plot_dimension_correlation(adata, absolute=True)