Skip to content

Commit 17607ba

Browse files
authored
Made most plotting parameter keyword-only (#510)
1 parent 07e0f0f commit 17607ba

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/spatialdata_plot/pl/basic.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def render_shapes(
157157
self,
158158
element: str | None = None,
159159
color: ColorLike | None = None,
160+
*,
160161
fill_alpha: float | int | None = None,
161162
groups: list[str] | str | None = None,
162163
palette: list[str] | str | None = None,
@@ -339,6 +340,7 @@ def render_points(
339340
self,
340341
element: str | None = None,
341342
color: ColorLike | None = None,
343+
*,
342344
alpha: float | int | None = None,
343345
groups: list[str] | str | None = None,
344346
palette: list[str] | str | None = None,
@@ -482,6 +484,7 @@ def render_points(
482484
def render_images(
483485
self,
484486
element: str | None = None,
487+
*,
485488
channel: list[str] | list[int] | str | int | None = None,
486489
cmap: list[Colormap | str] | Colormap | str | None = None,
487490
norm: Normalize | None = None,
@@ -599,6 +602,7 @@ def render_labels(
599602
self,
600603
element: str | None = None,
601604
color: str | None = None,
605+
*,
602606
groups: list[str] | str | None = None,
603607
contour_px: int | None = 3,
604608
palette: list[str] | str | None = None,
@@ -728,6 +732,7 @@ def render_labels(
728732
def show(
729733
self,
730734
coordinate_systems: list[str] | str | None = None,
735+
*,
731736
legend_fontsize: int | float | _FontSize | None = None,
732737
legend_fontweight: int | _FontWeight = "bold",
733738
legend_loc: str | None = "right margin",

tests/pl/test_render_labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData):
305305

306306
# Create a table that annotates a DIFFERENT element than the one we will render
307307
other_table = sdata_blobs_local["table"].copy()
308-
other_table.obs["region"] = "blobs_multiscale_labels"
308+
other_table.obs["region"] = pd.Categorical(["blobs_multiscale_labels"] * other_table.n_obs)
309309
other_table.uns["spatialdata_attrs"]["region"] = "blobs_multiscale_labels"
310310
sdata_blobs_local["other_table"] = other_table
311311

tests/pl/test_render_points.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData):
473473

474474
# Create a table that annotates a DIFFERENT element than the one we will render
475475
other_table = sdata_blobs_local["table"].copy()
476-
other_table.obs["region"] = "blobs_labels" # Different from blobs_points
476+
other_table.obs["region"] = pd.Categorical(["blobs_labels"] * other_table.n_obs) # Different from blobs_points
477477
other_table.uns["spatialdata_attrs"]["region"] = "blobs_labels"
478478
sdata_blobs_local["other_table"] = other_table
479479

tests/pl/test_render_shapes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def test_warns_when_table_does_not_annotate_element(sdata_blobs: SpatialData):
670670

671671
# Create a table that annotates a DIFFERENT element than the one we will render
672672
other_table = sdata_blobs_local["table"].copy()
673-
other_table.obs["region"] = "blobs_points" # Different from blobs_circles
673+
other_table.obs["region"] = pd.Categorical(["blobs_points"] * other_table.n_obs) # Different region
674674
other_table.uns["spatialdata_attrs"]["region"] = "blobs_points"
675675
sdata_blobs_local["other_table"] = other_table
676676

0 commit comments

Comments
 (0)