Skip to content

add shapes parameter to render shapes as hex/circle/square #474

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Sonja-Stockhaus
Copy link
Collaborator

Another feature from squidpy that we want to support here: the new shape argument in render_shapes() can be set to "circle", "hex" or "square" so that the shapes are converted to and redered as circles/hexagons/squares. If the argument is set to None (default), the shapes are rendered as they are.

First version of the conversion method (@timtreis up to discussion):

  • from circle to square/hex: the new shape lies exactly within the original circle
  • from (multi)polygon to circle: the convex hull is computed, then we take the center as the mean of the resulting points and choose the radius as the maximum of the distances between the center and every point on the convex hull
  • from (multi)polygon to square/hex: chain of (multi)polygon -> circle -> square/hex

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 92.04545% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.29%. Comparing base (c5cb734) to head (cfe9efe).

Files with missing lines Patch % Lines
src/spatialdata_plot/pl/utils.py 91.02% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #474      +/-   ##
==========================================
+ Coverage   85.00%   85.29%   +0.29%     
==========================================
  Files           8        8              
  Lines        1794     1877      +83     
==========================================
+ Hits         1525     1601      +76     
- Misses        269      276       +7     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/basic.py 89.26% <100.00%> (ø)
src/spatialdata_plot/pl/render.py 96.52% <100.00%> (+0.05%) ⬆️
src/spatialdata_plot/pl/render_params.py 100.00% <100.00%> (ø)
src/spatialdata_plot/pl/utils.py 79.03% <91.02%> (+0.83%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sonja-Stockhaus Sonja-Stockhaus marked this pull request as ready for review July 3, 2025 15:10
@Sonja-Stockhaus Sonja-Stockhaus requested a review from timtreis July 3, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants