From 2703e3e626b9661ee3b3cad4e4806eae5e130700 Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 10 Jul 2026 17:29:10 +0200 Subject: [PATCH] fix(scalebar): accept int for scalebar_dx _validate accepted int | float for scalebar_dx, but _get_scalebar narrowed to float via _get_list(..., _type=float), so an int value passed validation then raised 'Can't make a list from variable'. Align _get_list with the validation contract by accepting int | float. --- src/spatialdata_plot/pl/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spatialdata_plot/pl/utils.py b/src/spatialdata_plot/pl/utils.py index a3a74abf..02df942c 100644 --- a/src/spatialdata_plot/pl/utils.py +++ b/src/spatialdata_plot/pl/utils.py @@ -377,7 +377,7 @@ def _get_scalebar( len_lib: int | None = None, ) -> tuple[Sequence[float] | None, Sequence[str] | None]: if scalebar_dx is not None: - _scalebar_dx = _get_list(scalebar_dx, _type=float, ref_len=len_lib, name="scalebar_dx") + _scalebar_dx = _get_list(scalebar_dx, _type=(int, float), ref_len=len_lib, name="scalebar_dx") scalebar_units = "um" if scalebar_units is None else scalebar_units _scalebar_units = _get_list(scalebar_units, _type=str, ref_len=len_lib, name="scalebar_units") else: