.cv_by_group
- proteopy.pl.cv_by_group(adata, group_by, layer=None, zero_to_na=False, min_samples=None, force=False, order=None, color_scheme=None, alpha=0.8, hline=None, show_points=False, point_alpha=0.7, point_size=1, xlabel_rotation=0, figsize=(6, 4), show=True, ax=False, save=None)[source]
Compute per-group coefficients of variation and plot their distributions.
- Parameters:
adata (AnnData) – AnnData object that contains proteomics quantifications.
group_by (str) – Column in
adata.obsused to define observation groups for CV calculation.layer (str | None, optional) – AnnData layer to read intensities from. Defaults to
adata.X.zero_to_na (bool, optional) – Replace zero values with NaN before computing CVs. Default is
False.min_samples (int | None, optional) – Minimum number of observations per variable required to compute a CV. Variables with fewer non-NaN entries receive NaN. Default is
3. Ignored when using precomputed CV data fromadata.varm.force (bool, optional) – Force recomputation of CV values even if precomputed data exists in
adata.varm. WhenTrue, uses a temporary slot that is deleted after extracting the data. Default isFalse.order (list | None, optional) – Explicit order of group labels (without the
cv_prefix) along the x-axis. WhenNonethe observed group order is used.color_scheme (sequence, dict | None, optional) – Color assignments for groups. When None, uses the Matplotlib default color cycle.
alpha (float, optional) – Transparency for the violin bodies. Default is
0.8.hline (float | None, optional) – If set, draw a horizontal dashed line at this CV value.
show_points (bool, optional) – Overlay individual variable CVs as a strip plot. Default is
False.point_alpha (float, optional) – Opacity for individual points when
show_pointsisTrue.point_size (float, optional) – Size of the individual CV points. Default is
1.xlabel_rotation (float, optional) – Rotation angle (degrees) for the x-axis group labels.
figsize (tuple of float, optional) – Matplotlib figure size in inches. Default is
(6, 4).show (bool, optional) – Call
plt.show()whenTrue. Default isTrue.ax (bool, optional) – Return the Matplotlib Axes if
True.save (str | None, optional) – Path to save the figure. When
Nonethe figure is not saved.