SpatialQuery.spatial_query.plot_fp_heatmap

spatial_query.plot_fp_heatmap(fp_df, figsize=(7, 5), save_path=None, title=None, cmap='GnBu')[source]

Plot a heatmap showing the distribution of cell types in frequent patterns.

Parameters:
  • fp_df (pd.DataFrame) –

    DataFrame containing frequent pattern results with two columns:
    • support: frequency of the pattern (proportion of points with this pattern)

    • itemsets: frozenset of cell types in the frequent pattern

    This is typically the output from find_fp_knn or find_fp_dist methods.

  • figsize (tuple, default=(7, 5)) – Figure size.

  • save_path (str, optional) – Path to save the figure. If None, the figure will not be saved.

  • title (str, optional) – Figure title. If None, will use a default title.

  • cmap (str, default='GnBu') – Colormap for the heatmap.

Returns:

Displays a heatmap showing the cell type distribution across frequent patterns. Rows represent cell types, columns represent pattern groups (sorted by support), and cell values show the support frequency.

Return type:

None