Skip to content

Commit 65281f6

Browse files
committed
Fix render_labels silently rendering invisible labels when fill_alpha=0 and outline_alpha=0 (#630)
The dispatch chain's first branch matched `fill_alpha == outline_alpha`, routing the (0, 0) case to the fill-only path with alpha=0 and leaving the existing ValueError as dead code. Add an explicit guard so the error is actually raised.
1 parent 072f04e commit 65281f6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/spatialdata_plot/pl/render.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,11 @@ def _draw_labels(
17641764
if effective_outline_color is None and col_for_color is None and render_params.color is not None:
17651765
effective_outline_color = render_params.color
17661766

1767+
if render_params.fill_alpha == 0.0 and render_params.outline_alpha == 0.0:
1768+
raise ValueError(
1769+
"Parameters 'fill_alpha' and 'outline_alpha' cannot both be 0. Set at least one to a positive value."
1770+
)
1771+
17671772
# default case: no contour, just fill
17681773
# since contour_px is passed to skimage.morphology.erosion to create the contour,
17691774
# any border thickness is only within the label, not outside. Therefore, the case

0 commit comments

Comments
 (0)