harpy.qc.obs_scatter

Contents

harpy.qc.obs_scatter#

harpy.qc.obs_scatter(sdata, table_name, labels_name=None, column_x='shapeSize', column_y='total_counts', ax=None, figsize=(6, 4), title=None, display_column_x=None, display_column_y=None, cmap=None, histplot_kwargs=mappingproxy({}), show_regplot=True, regplot_kwargs=mappingproxy({}))#

Plot the relationship between two observation-level columns.

Parameters:
  • sdata (SpatialData) – SpatialData object containing the table.

  • table_name (str) – Table element in sdata.tables.

  • labels_name (str | Iterable[str] | None (default: None)) – Labels element or elements used to subset the selected table via ProcessTable. If None, all observations in table_name are used.

  • column_x (str (default: 'shapeSize')) – Observation-level column in adata.obs to plot on the x-axis.

  • column_y (str (default: 'total_counts')) – Observation-level column in adata.obs to plot on the y-axis.

  • ax (Axes | None (default: None)) – Matplotlib axes to draw on. If None, a new figure and axes are created.

  • figsize (tuple[float, float] (default: (6, 4))) – Figure size used when ax is None.

  • title (str | None (default: None)) – Plot title. Defaults to "{x column} vs {y column}".

  • display_column_x (str | None (default: None)) – Display label for column_x. If None, a readable label is inferred from the column name.

  • display_column_y (str | None (default: None)) – Display label for column_y. If None, a readable label is inferred from the column name.

  • cmap (str | None (default: None)) – Colormap passed to seaborn.histplot(). If None, seaborn’s default is used.

  • histplot_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments passed to seaborn.histplot().

  • show_regplot (bool (default: True)) – Whether to overlay seaborn.regplot(). Enabled by default.

  • regplot_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments passed to seaborn.regplot() when show_regplot=True.

Return type:

Axes

Returns:

: matplotlib.axes.Axes containing the relationship plot.

Examples

import harpy as hp

sdata = hp.datasets.xenium_human_ovarian_cancer(
    subset=True,
    processed=True,
)

hp.qc.obs_scatter(
    sdata,
    table_name="table_transcriptomics_preprocessed",
    column_x="shapeSize",
    column_y="total_counts",
)