Skip to content

Commit 69b83f5

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 75434d6 commit 69b83f5

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
@@ -1756,6 +1756,11 @@ def _draw_labels(
17561756
if effective_outline_color is None and col_for_color is None and render_params.color is not None:
17571757
effective_outline_color = render_params.color
17581758

1759+
if render_params.fill_alpha == 0.0 and render_params.outline_alpha == 0.0:
1760+
raise ValueError(
1761+
"Parameters 'fill_alpha' and 'outline_alpha' cannot both be 0. Set at least one to a positive value."
1762+
)
1763+
17591764
# default case: no contour, just fill
17601765
# since contour_px is passed to skimage.morphology.erosion to create the contour,
17611766
# any border thickness is only within the label, not outside. Therefore, the case

0 commit comments

Comments
 (0)