Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/spatialdata_plot/pl/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,9 @@ def render_labels(
color names (must match the number of groups), a single named palette or matplotlib colormap name, or
``None``.
contour_px : int, default 3
Draw contour of specified width for each segment. If `None`, fills entire segment, see:
func:`skimage.morphology.erosion`.
Draw contour of specified width for each segment. Must be >= 2; ``contour_px=1`` is rejected
because a 1x1 erosion is the identity transformation and produces no visible outline. If
``None``, fills entire segment, see :func:`skimage.morphology.erosion`.
cmap : Colormap | str | None, optional
Colormap for continuous annotations using 'color', see :class:`matplotlib.colors.Colormap`.
For categorical data, use ``palette`` instead.
Expand Down
7 changes: 5 additions & 2 deletions src/spatialdata_plot/pl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2368,8 +2368,11 @@ def _type_check_params(param_dict: dict[str, Any], element_type: str) -> dict[st
else:
param_dict["outline_color"] = Color(outline_color)

if contour_px is not None and contour_px <= 0:
raise ValueError("Parameter 'contour_px' must be a positive number.")
if contour_px is not None and contour_px < 2:
raise ValueError(
"Parameter 'contour_px' must be >= 2; values below 2 produce no visible outline "
"(a 1x1 erosion is the identity transformation)."
)

alpha = param_dict.get("alpha")
if alpha is not None:
Expand Down
Loading