.intensity_hist

proteopy.pl.intensity_hist(adata, layer=None, color_imputed=False, bool_layer=None, log_transform=None, ignore_warning=False, fill_na=None, zero_to_nan=False, bins=60, density=True, kde=False, color_scheme=None, xlim=None, alpha=0.6, title=None, legend_loc='upper right', figsize=(7, 4), per_obs=False, samples=None, ncols=4, sharex=True, sharey=True, show=True, ax=False, save=None)[source]

Plot histogram(s) of var intensities, optionally colored by imputation status.

Parameters:
  • adata (AnnData) – Proteomics AnnData containing the intensity matrix.

  • layer (str | None, optional) – Layer to use for intensities; defaults to adata.X when None.

  • color_imputed (bool, optional) – When True, overlay imputed values using the layer-specific mask; otherwise plot a single distribution of all intensities.

  • bool_layer (str | None, optional) – Layer key containing the imputation mask. When None and color_imputed is True, use imputation_mask_<layer> (with layer="X" for the main matrix).

  • log_transform (float | int | None, optional) – Logarithm base (>0 and !=1). When None skip log-transforming; otherwise apply log(value + 1, base) after validating the input (Defaut = None).

  • ignore_warning (bool, optional) – When True, force the log transform even if the data already appear log-transformed according to copro.utils.array.is_log_transformed().

  • fill_na (float | int | None, optional) – Replace missing values with this constant before log transformation.

  • zero_to_nan (bool, optional) – When True, replace exact zeros with NaN before plotting.

  • bins (int, optional) – Number of histogram bins passed to numpy.histogram_bin_edges.

  • density (bool, optional) – Plot density instead of counts.

  • kde (bool, optional) – Overlay kernel density estimate curves.

  • color_scheme (Any, optional) – Palette specification forwarded to proteopy.utils.matplotlib._resolve_color_scheme().

  • xlim (tuple[float | int, float | int] | None, optional) – Explicit x-axis limits (xmin, xmax) applied to all histograms.

  • alpha (float, optional) – Histogram transparency (0-1 range).

  • title (str | None, optional) – Custom title for the plot; defaults are auto-generated.

  • legend_loc (str, optional) – Location argument forwarded to matplotlib.axes.Axes.legend().

  • figsize (tuple[float, float], optional) – Figure size passed to matplotlib.pyplot.subplots().

  • per_obs (bool, optional) – When True, draw per-observation facets; otherwise aggregate all values.

  • samples (list | None, optional) – Optional ordered subset of observations (by index or name) for per_obs plots.

  • ncols (int, optional) – Number of columns in the per-observation facet grid.

  • sharex (bool, optional) – Whether subplots share their x- or y-axes in per-observation mode.

  • sharey (bool, optional) – Whether subplots share their x- or y-axes in per-observation mode.

  • show (bool, optional) – If True, call plt.show() at the end.

  • ax (bool, optional) – When True and per_obs is False, return the Axes handle and skip automatic plotting even if show is True.

  • save (str | Path | None, optional) – Path where the figure should be written. When None, no file is saved.

Returns:

Axes handle when ax is True (single histogram mode); otherwise None.

Return type:

Axes | None