diffsvg.pl.plot_volcano#
- diffsvg.pl.plot_volcano(stats_df, x=None, pvalue=None, pvalue_adj=None, alpha=0.05, show_dots=True, n_label=20, highlight_genes=None, highlight_offset=(0.025, 1.25), ax=None, figsize=(4, 6), save_path=None)#
Volcano plot of per-gene curve difference vs. significance.
- Parameters:
- stats_df
A statistics table indexed by gene, e.g.
adata.varm["dsvg_stats"].- x default:
None Column used for the x-axis. Defaults to
"integral"(area between the two condition curves) for the Wald test and"slope_diff"(linear trend off1 - f0over the anchor range) fortest="parallel";"integral"there shows level against shape.- pvalue default:
None Column used for the y-axis, plotted as
-log10(pvalue). Every point above the-log10(alpha)reference line is colored by the sign ofx(blue = positive, red = negative); points at or below it are black. Defaults to"wald_pval"for the Wald test and"parallel_pval"fortest="parallel". p-values of exactly 0 (underflow) are drawn at the smallest non-zero one; genes with a missing p-value orx(e.g. not fitted) are left out.- pvalue_adj default:
None Column used to rank genes for labeling (the
n_labelgenes with the smallestpvalue_adjamong those above the line get a text label). Defaults to the adjusted version of the defaultpvalue.- alpha default:
0.05 Significance threshold on
pvalue, drawn as a horizontal reference line at-log10(alpha)and used for the color cutoff described underpvalue.- show_dots default:
True If
True(default), every gene is drawn as a colored dot. IfFalse, every gene’s name is drawn instead, in the same color, in place of a dot - there is no separate background scatter in that mode. Best suited to modest gene panels (a few hundred genes); subsetstats_dffirst for larger ones.- n_label default:
20 Label at most this many of the genes above the line (the ones with the smallest
pvalue_adj) with their gene name. UseNoneto label every gene above the line, or0to label none. Labels use the same collision-avoidance ashighlight_genes(see below).- highlight_genes default:
None A gene name, or list of gene names, to draw with a larger red point and a bold, boxed, arrow-annotated label on top of the rest. Raises
KeyErrorif any given gene is not instats_df.index.- highlight_offset default:
(0.025, 1.25) (dx, dy)offset (in data units) tried first for eachhighlight_geneslabel; if that spot is already occupied (by a dot, another gene’s name, or another label), a nearby spot is used instead - so with several highlighted genes this is a preference, not a guarantee.- ax default:
None Existing axes to draw into; a new figure is created if omitted.
- figsize default:
(4, 6) Passed to
plt.subplotswhenaxis omitted.- save_path default:
None If given, save the figure here (
dpi=300, bbox_inches="tight").
- Returns:
matplotlib.axes.Axes