Skip to content

Commit 96b3bba

Browse files
authored
minor fix for specifying the element (#51)
1 parent 18c2f92 commit 96b3bba

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/spatialdata_plot/pl/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def show(
508508

509509
# check that coordinate system and elements to be rendered match
510510
for cmd, params in render_cmds.items():
511-
if params.element is not None and len(params.element) != len(coordinate_system):
511+
if params.element is not None and len([params.element]) != len(coordinate_system):
512512
raise ValueError(
513513
f"Number of coordinate systems ({len(coordinate_system)}) does not match number of elements "
514514
f"({len(params.element)}) in command {cmd}."

src/spatialdata_plot/pl/render.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def _get_collection_shape(
106106
**kwargs: Any,
107107
) -> PatchCollection:
108108
"""Get collection of shapes."""
109-
if shapes["geometry"][0].geom_type == "Polygon":
109+
if shapes["geometry"].iloc[0].geom_type == "Polygon":
110110
patches = [Polygon(p.exterior.coords, closed=False) for p in shapes["geometry"]]
111-
elif shapes["geometry"][0].geom_type == "Point":
111+
elif shapes["geometry"].iloc[0].geom_type == "Point":
112112
patches = [Circle((circ.x, circ.y), radius=r * s) for circ, r in zip(shapes["geometry"], shapes["radius"])]
113113

114114
collection = PatchCollection(patches, snap=False, **kwargs)

0 commit comments

Comments
 (0)