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

Visualization

Objective: inspect fitted distributions and outlier outcomes without changing the data or refitting thresholds.

Plot functions read the existing QC metric columns and stored fit metadata. They require the optional plot extra. With show=False, they return Matplotlib handles for further composition.

import matplotlib.pyplot as plt
import verymadpy as vm

axes = vm.pl.violin(adata, key_added="sample_qc", show=False)
axes = vm.pl.raincloud(adata, key_added="sample_qc", max_points=500, seed=0, show=False)
vm.pl.outlier_summary(
    adata,
    key_added="sample_qc",
    percent=True,
    combined_only=True,
    save="outcomes.svg",
    show=False,
)
fig, axes = vm.pl.qc_summary(
    adata,
    key_added="sample_qc",
    kind="raincloud",
    save="qc-review.pdf",
    show=False,
)

The violin plot limits displayed values per metric and sample by default. Raincloud density and boxplot statistics use every valid observation; max_points limits only the reproducibly sampled, rasterized points. Neither plot uses sampled values to estimate thresholds.

outlier_summary(percent=True) uses all current observations in each group as the denominator, including undefined classifications. Per-metric bars can overlap. combined_only=True displays the mutually exclusive retained, flagged, and undefined outcomes. See violin, raincloud, outlier_summary, and qc_summary.

Compose with Matplotlib

fig, axes = plt.subplots(1, 2, figsize=(10, 4), layout="constrained")
vm.pl.violin(
    adata,
    metrics=["total_counts"],
    key_added="sample_qc",
    ax=axes[0],
    show=False,
)
vm.pl.outlier_summary(
    adata,
    key_added="sample_qc",
    percent=True,
    combined_only=True,
    ax=axes[1],
    show=False,
)
fig.savefig("qc-review.png", dpi=180)

Figures can be exported directly with save="figure.svg", "figure.pdf", or "figure.png". The plotting functions use Matplotlib and Seaborn without changing global plotting settings.