.hclustv_profile_intensities

proteopy.pl.hclustv_profile_intensities(adata, profiles=None, profile_key='auto', group_by=None, sort_by=None, order=None, n_cols=2, n_rows=3, title=None, titles=None, xlabel_rotation=45, sort_by_label_rotation=0, ylabel='Intensity', marker='o', markersize=6, linewidth=1.5, errorbar='se', color=None, figsize=None, show=True, ax=False, save=None, verbose=True)[source]

Plot cluster profile intensities across observations.

Displays line plots for each cluster profile showing how intensity varies across observations. When group_by is specified, observations are grouped and error bars are displayed.

Parameters:
  • adata (AnnData) – AnnData with cluster profiles stored in .uns from proteopy.tl.hclustv_profiles().

  • profiles (str | list[str] | None) – Profile column(s) to plot from the profiles DataFrame. When None, plots the first 6 profiles or fewer if not available. Can be a single profile name (e.g., "01") or a list of names.

  • profile_key (str) – Key in adata.uns for the profiles DataFrame. When 'auto', auto-detects keys matching hclustv_profiles;*.

  • group_by (str | pd.Series | dict | None) – Grouping for x-axis observations. When str, uses the column from adata.obs to group observations and display error bars. When pd.Series, uses Series index as observation keys and values as group labels. When dict, maps observation indices to group labels directly. When None, plots individual observations without grouping. If the column or Series is categorical, the category order is respected for x-axis ordering. Mutually exclusive with sort_by.

  • sort_by (str | pd.Series | dict | None) – Sort individual observations by group membership without aggregating. When str, uses the column from adata.obs. When pd.Series, uses Series index as observation keys and values as sort groups. When dict, maps observation indices to sort groups directly. Observations are ordered by their group, with group order determined by order (if provided) or categorical order (if categorical). Mutually exclusive with group_by.

  • order (list[str] | None) – Order of groups on the x-axis. When group_by is specified, controls the order of grouped categories. When sort_by is specified, controls the order in which sort groups appear. When None, uses categorical order if available, otherwise sorted alphabetically.

  • n_cols (int) – Number of columns in the subplot grid.

  • n_rows (int) – Number of rows in the subplot grid.

  • title (str | None) – Overall figure title. When None, no suptitle is added.

  • titles (list[str] | dict[str, str] | None) – Custom titles for each subplot. When list, must have the same length as the number of plotted profiles. When dict, maps profile/cluster names to custom titles. When None, uses default titles ("Cluster {profile_name}").

  • xlabel_rotation (float) – Rotation angle (degrees) for x-axis tick labels.

  • sort_by_label_rotation (float) – Rotation angle (degrees) for sort group labels when sort_by is used.

  • ylabel (str) – Label for the y-axis of each subplot.

  • marker (str) – Marker style for data points.

  • markersize (float) – Size of data point markers.

  • linewidth (float) – Width of connecting lines.

  • errorbar (str | tuple) – Error bar style for grouped data. Passed to sns.lineplot. Common options: 'se' (standard error), 'sd' (standard deviation), 'ci' (confidence interval), ('ci', 95).

  • color (str | None) – Color for the line and markers. When None, uses default palette.

  • figsize (tuple[float, float] | None) – Figure size. When None, auto-computed based on grid dimensions.

  • show (bool) – Display the figure.

  • ax (bool) – Return the Matplotlib Axes objects instead of displaying.

  • save (str | Path | None) – File path for saving the figure.

  • verbose (bool) – Print status messages including auto-detected keys.

Returns:

List of Axes objects when ax is True; otherwise None.

Return type:

list[Axes] | None

Raises:
  • ValueError – If no cluster profiles are found in adata.uns, if multiple candidates exist and profile_key is not specified, or if specified profiles are not found in the DataFrame.

  • KeyError – If the specified profile_key is not found, or if group_by column is not found in adata.obs.

  • TypeError – If the profiles data is not a pandas DataFrame.

Examples

>>> import proteopy as pr
>>> adata = pr.datasets.karayel_2020()
>>> pr.tl.hclustv_tree(adata, group_by="condition")
>>> pr.tl.hclustv_cluster_ann(adata, k=5)
>>> pr.tl.hclustv_profiles(adata)
>>> pr.pl.hclustv_profile_intensities(adata)

Plot with grouping and error bars:

>>> pr.pl.hclustv_profile_intensities(adata, group_by="condition")

Plot specific profiles:

>>> pr.pl.hclustv_profile_intensities(adata, profiles=["01", "03"])