Skip to content

Commit 3948928

Browse files
fix _get_collection_shape for when data contains empty points
1 parent 73fd58c commit 3948928

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/spatialdata_plot/pl/render.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def _get_collection_shape(
121121
) -> PatchCollection:
122122
patches = []
123123
for shape in shapes:
124+
# remove empty points/polygons
125+
shape = shape[shape["geometry"].apply(lambda geom: not geom.is_empty)]
124126
# We assume that all elements in one collection are of the same type
125127
if shape["geometry"].iloc[0].geom_type == "Polygon":
126128
patches += [Polygon(p.exterior.coords, closed=True) for p in shape["geometry"]]

0 commit comments

Comments
 (0)