Skip to content

Conversation

@timtreis
Copy link
Member

No description provided.

@timtreis timtreis linked an issue Nov 17, 2025 that may be closed by this pull request
@timtreis timtreis linked an issue Nov 17, 2025 that may be closed by this pull request
@timtreis
Copy link
Member Author

Hey @rushin682 and @quentinblampey, could you verify that your data works with this branch?

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.84%. Comparing base (b07ada7) to head (37958af).

Files with missing lines Patch % Lines
src/spatialdata_plot/pl/utils.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #513      +/-   ##
==========================================
+ Coverage   84.80%   84.84%   +0.03%     
==========================================
  Files           8        8              
  Lines        2146     2158      +12     
==========================================
+ Hits         1820     1831      +11     
- Misses        326      327       +1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 91.07% <100.00%> (+0.01%) ⬆️
src/spatialdata_plot/pl/utils.py 80.94% <90.90%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis linked an issue Nov 19, 2025 that may be closed by this pull request
@timtreis timtreis merged commit 64aeb73 into main Nov 19, 2025
4 checks passed
@quentinblampey
Copy link

Hi @timtreis, thanks for the fix!
Sorry for the delay, I wanted to have a look tomorrow. I guess it'll look good, but I'll let you know if not

@quentinblampey
Copy link

quentinblampey commented Nov 20, 2025

Actually I had some time to test it right now @timtreis, and, while it worked well on simple polygons, it didn't work on more complex polygons.

Here is an example:

from shapely import Polygon
from geopandas import GeoDataFrame
from spatialdata import SpatialData
from spatialdata.models import ShapesModel
import spatialdata_plot

ext = [
    (7.866043666934409, 32.80184055229537),
    (19.016191271980425, 203.48380872801957),
    (75.90086964475744, 236.02570144190528),
    (229.48380872801957, 235.98380872801957),
    (235.98380872801957, 5.516191271980426),
    (197.42585593903195, 6.144892860751103),
    (116.5, 96.4575926540027),
    (55.65582863082729, 12.531294107459374),
    (7.866043666934409, 32.80184055229537),
]

interior = [
    (160.12353079731844, 173.21221665537414),
    (181.80184055229537, 159.13395633306558),
    (198.86604366693442, 179.80184055229537),
    (178.19815944770465, 198.86604366693442),
    (160.12353079731844, 173.21221665537414),
]
polygon = Polygon(ext, [interior])

geo_df = GeoDataFrame(geometry=[polygon])

sdata = SpatialData(shapes={"test": ShapesModel.parse(geo_df)})

sdata.pl.render_shapes("test").pl.show()
image

While GeoPandas shows:

image

Do you really need to convert it to a multipolygon? I think the inner geopandas function _plot_polygon_collection from geopandas.plotting already handles everything without the need for conversion. Is there a reason not to use it?

@timtreis
Copy link
Member Author

I have a bit of preemptive PTSD for making all transformations/parameters etc work if we'd swap to a new plotting function. We'd also loose control over the internals of it. Let me dig into that issue, I really thought it would be solved. The logger also correctly notices that there is a hole, it just doesn't plot it for some reason. I'm confused as to why this polygon is different from your previous example

@quentinblampey
Copy link

Yes, I'll also try many different things to understand what's different from the other polygon, but I couldn't find a solution yet...

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.

render_shapes cannot handle shapes with multiple holes Handling Annotations from QuPath MultiPolygons with holes are broken

4 participants