Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

vm.pl.raincloud

Draw QC distributions as half violins, boxplots, and jittered points.

Signature

def raincloud(
    data: ad.AnnData | pd.DataFrame,
    *,
    metrics: Sequence[str] | str | None = None,
    key_added: str | None = None,
    groupby: str | None = None,
    order: Sequence[str | None] | None = None,
    transformed: bool = False,
    show_thresholds: bool = True,
    palette: str | Sequence = "Set2",
    titles: Sequence[str] | None = None,
    figsize: tuple[float, float] | None = None,
    ax: Axes | Sequence[Axes] | np.ndarray | None = None,
    max_points: int | None = 1000,
    seed: int = 0,
    show: bool = True,
    save: str | Path | None = None,
) -> tuple[Axes, ...] | None: ...

Parameters

NameTypeDefaultDescription
data`ad.AnnDatapd.DataFrame`required
metrics`Sequence[str]strNone`
key_added`strNone`None
groupby`strNone`None
order`Sequence[strNone]None`
transformedboolFalsePlot values in fitting units instead of original metric units.
show_thresholdsboolTrueOverlay defined thresholds from the stored fit.
palette`strSequence`'Set2'
titles`Sequence[str]None`None
figsize`tuple[float, float]None`None
ax`AxesSequence[Axes]np.ndarray
max_points`intNone`1000
seedint0Random seed for reproducible point subsampling and jitter.
showboolTrueDisplay the figure. If False, return the axes.
save`strPathNone`

Returns

tuple of matplotlib.axes.Axes or None

One axes per metric when show=False.

Raises

ImportError

If the optional plotting dependencies are not installed.

KeyError

If a requested metric, grouping column, or fitted run is missing.

ValueError

If the metric selection, group order, or display options are invalid.

Notes

Density and boxplot statistics use every finite observation. max_points limits only the rasterized jittered points. Stored thresholds are not refitted. Plotting reads the observation table and fit metadata without changing them.

See Also

Examples

import verymadpy as vm

axes = vm.pl.raincloud(adata, max_points=500, seed=1, show=False)