diffsvg.pl.plot_prediction_curve#

diffsvg.pl.plot_prediction_curve(adata, gene, curves_key='dsvg_curves', condition_labels=None, colors=None, ncols=4, figsize=(4, 3.2), ax=None, dpi=300, save_path=None)#

Plot the predicted expression curve (posterior mean +/- credible band) per gene, for both conditions.

Reads the six adata.varm[f"{curves_key}_cond{0,1}_{mean,ci_low,ci_high}"] tables written by diffsvg.tl.fit_model. Several genes are drawn as a grid of panels, one gene each, each with its own axis ranges because genes differ in scale.

Parameters:
adata

Annotated data matrix that diffsvg.tl.fit_model wrote into.

gene

A gene name, or a list of them (all must be in adata.var_names).

curves_key default: 'dsvg_curves'

Prefix used by diffsvg.tl.fit_model for the per-condition curve adata.varm entries.

condition_labels default: None

{"0": label, "1": label} for the legend. Defaults to adata.uns[f"{curves_key}_condition_categories"] if present, otherwise generic "condition 0"/"condition 1" labels.

colors default: None

{0: color, 1: color} for the two curves.

ncols default: 4

Panels per row when several genes are given. Fewer genes than this give a single, narrower row.

figsize default: (4, 3.2)

(width, height) of a single panel in inches.

ax default: None

Existing axes to draw into, for a single gene; a new figure is created if omitted.

dpi default: 300

Resolution used when saving to save_path.

save_path default: None

If given, save the figure here (bbox_inches="tight").

Returns:

A matplotlib.axes.Axes when one gene is given, otherwise an array of them, one per gene in the order passed.

Examples

>>> dvg.pl.plot_prediction_curve(adata, gene=["PAX7", "IRX3"])