campmc.pl.metric_ecdf

Contents

campmc.pl.metric_ecdf#

campmc.pl.metric_ecdf(values, out_png=None, *, title='Metric ECDF', show=False)[source]#

Save or display an empirical CDF plot for a 1-D metric array.

Parameters:
values ndarray

Metric values; non-finite entries are dropped.

out_png str | Path | None (default: None)

If set, write the figure to this path (PNG).

title str (default: 'Metric ECDF')

Plot title.

show bool (default: False)

If True, display via plt.show() and return None.

Return type:

Figure | None

Returns:

The figure when show is false and out_png is not set; otherwise None after saving or displaying.

Examples

import campmc as cp
import scanpy as sc
adata = sc.datasets.pbmc68k_reduced()
cp.partition(adata, method="camp3", gamma=50, random_state=0)
qc = cp.mt.quality(adata, partition_key="camp")
cp.pl.metric_ecdf(qc["sc_ratio"].to_numpy(), title="sc_ratio ECDF", show=True)