Skip to content

minor fix for specifying the element #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/spatialdata_plot/pl/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def show(

# check that coordinate system and elements to be rendered match
for cmd, params in render_cmds.items():
if params.element is not None and len(params.element) != len(coordinate_system):
if params.element is not None and len([params.element]) != len(coordinate_system):
raise ValueError(
f"Number of coordinate systems ({len(coordinate_system)}) does not match number of elements "
f"({len(params.element)}) in command {cmd}."
Expand Down
4 changes: 2 additions & 2 deletions src/spatialdata_plot/pl/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def _get_collection_shape(
**kwargs: Any,
) -> PatchCollection:
"""Get collection of shapes."""
if shapes["geometry"][0].geom_type == "Polygon":
if shapes["geometry"].iloc[0].geom_type == "Polygon":
patches = [Polygon(p.exterior.coords, closed=False) for p in shapes["geometry"]]
elif shapes["geometry"][0].geom_type == "Point":
elif shapes["geometry"].iloc[0].geom_type == "Point":
patches = [Circle((circ.x, circ.y), radius=r * s) for circ, r in zip(shapes["geometry"], shapes["radius"])]

collection = PatchCollection(patches, snap=False, **kwargs)
Expand Down