.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_byis specified, observations are grouped and error bars are displayed.- Parameters:
adata (AnnData) –
AnnDatawith cluster profiles stored in.unsfromproteopy.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.unsfor the profiles DataFrame. When'auto', auto-detects keys matchinghclustv_profiles;*.group_by (str | pd.Series | dict | None) – Grouping for x-axis observations. When
str, uses the column fromadata.obsto group observations and display error bars. Whenpd.Series, uses Series index as observation keys and values as group labels. Whendict, maps observation indices to group labels directly. WhenNone, plots individual observations without grouping. If the column or Series is categorical, the category order is respected for x-axis ordering. Mutually exclusive withsort_by.sort_by (str | pd.Series | dict | None) – Sort individual observations by group membership without aggregating. When
str, uses the column fromadata.obs. Whenpd.Series, uses Series index as observation keys and values as sort groups. Whendict, maps observation indices to sort groups directly. Observations are ordered by their group, with group order determined byorder(if provided) or categorical order (if categorical). Mutually exclusive withgroup_by.order (list[str] | None) – Order of groups on the x-axis. When
group_byis specified, controls the order of grouped categories. Whensort_byis specified, controls the order in which sort groups appear. WhenNone, 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. Whendict, maps profile/cluster names to custom titles. WhenNone, 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_byis 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
axisTrue; otherwiseNone.- Return type:
list[Axes] | None
- Raises:
ValueError – If no cluster profiles are found in
adata.uns, if multiple candidates exist andprofile_keyis not specified, or if specified profiles are not found in the DataFrame.KeyError – If the specified
profile_keyis not found, or ifgroup_bycolumn is not found inadata.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"])