diff --git a/src/harpy/image/pixel_clustering/_clustering.py b/src/harpy/image/pixel_clustering/_clustering.py index f19889b..6f7a5e3 100644 --- a/src/harpy/image/pixel_clustering/_clustering.py +++ b/src/harpy/image/pixel_clustering/_clustering.py @@ -59,7 +59,7 @@ def flowsom( sdata The input SpatialData object. img_layer - The image layer(s) of `sdata` on which flowsom is run. It is recommended to preprocess the data with `harpy.im.pixel_clustering_preprocess`. + The image layer(s) of `sdata` on which flowsom is run. It is recommended to preprocess the data with :func:`harpy.im.pixel_clustering_preprocess`. output_layer_clusters The output labels layer in `sdata` to which labels layer with predicted flowsom SOM clusters are saved. output_layer_metaclusters @@ -107,7 +107,7 @@ def flowsom( Warnings -------- - The function is intended for use with spatial proteomics data. Input data should be appropriately preprocessed - (e.g. via `harpy.im.pixel_clustering_preprocess`) to ensure meaningful clustering results. + (e.g. via :func:`harpy.im.pixel_clustering_preprocess`) to ensure meaningful clustering results. - The cluster and metacluster ID's found in `output_layer_clusters` and `output_layer_metaclusters` count from 1, while they count from 0 in the `FlowSOM` object. """ assert 0 < fraction <= 1, "Value must be between 0 and 1" diff --git a/src/harpy/plot/_flowsom.py b/src/harpy/plot/_flowsom.py index 8d65b89..c6f78d6 100644 --- a/src/harpy/plot/_flowsom.py +++ b/src/harpy/plot/_flowsom.py @@ -41,7 +41,7 @@ def pixel_clusters( **kwargs, # passed to pl.show() of spatialdata_plot ): """ - Visualize spatial distribution of pixel clusters based on labels in a `SpatialData` object, obtained using `harpy.im.flowsom`. + Visualize spatial distribution of pixel clusters based on labels in a `SpatialData` object, obtained using :func:`harpy.im.flowsom`. Parameters ---------- @@ -163,7 +163,7 @@ def pixel_clusters_heatmap( sdata The input SpatialData object. table_layer - The table layer in `sdata` containing cluster intensity for clusters and metaclusters, obtained via `hp.tb.cluster_intensity`. + The table layer in `sdata` containing cluster intensity for clusters and metaclusters, obtained via :func:`harpy.tb.cluster_intensity`. metaclusters Whether to display mean channel intensity per metacluster (`True`) or per cluster (`False`). z_score @@ -172,13 +172,17 @@ def pixel_clusters_heatmap( The value to clip the z-scored data to, for better visualization. If `None`, no clipping is performed. Ignored if `z_score` is `False`. output - The path to save the generated heatmap. If `None`, the heatmap will be displayed directly using `plt.show()`. + The path to save the generated heatmap. If `None`, the heatmap will be displayed directly using :func:`matplotlib.pyplot.show`. figsize - Size of the figure in inches (width, height). + Tuple specifying the size of the figure in inches as `(width, height)`. + The width determines the spacing available for cluster IDs, while the height adjusts space for channels. + If labels (cluster IDs or channel names) are truncated, increase the respective dimension. + Increase `width` if cluster IDs or are not fully visible. + Increase `height` if channel names are not fully visible. fig_kwargs - Additional keyword arguments passed to `plt.figure`, such as `dpi`. + Additional keyword arguments passed to :func:`matplotlib.pyplot.figure`, such as `dpi`. **kwargs - Additional keyword arguments passed to `sns.heatmap`, such as `annot`, `cmap`, or `cbar_kws`. + Additional keyword arguments passed to :func:`seaborn.heatmap`, such as `annot`, `cmap`, or `cbar_kws`. Returns -------