Skip to content

fix #464 #465

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 1 commit into
base: main
Choose a base branch
from
Open

fix #464 #465

wants to merge 1 commit into from

Conversation

sophiamaedler
Copy link

Code which previously failed now generates the expected results:

import spatialdata
import spatialdata_plot
sdata = spatialdata.datasets.blobs()

# add some labelling we want to color with a custom defined palette
sdata["table"].obs["labelling"] = (sdata["table"].obs["instance_id"]>10).astype('int').astype('str')
sdata["table"].obs["labelling"] = sdata["table"].obs["labelling"].astype('category')

# with labels it works
sdata.pl.render_labels("blobs_labels", color = "labelling", palette = ["red", "blue"], groups = ["0", "1"]).pl.show()
# transform to shapes and add necessary annotation
sdata["test_labels"] = spatialdata.to_polygons(sdata["blobs_labels"])

adata = sdata["table"].copy()
adata.obs["region"] = "test_labels"
adata.uns["spatialdata_attrs"]["region"] = "test_labels"
sdata["test_annotation"] = spatialdata.models.TableModel.parse(adata)

# with shapes it throws an error
sdata.pl.render_shapes("test_labels", color = "labelling", palette = ["red", "blue"], groups = ["0", "1"]).pl.show()

image

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.00%. Comparing base (c5cb734) to head (34ad288).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #465   +/-   ##
=======================================
  Coverage   85.00%   85.00%           
=======================================
  Files           8        8           
  Lines        1794     1794           
=======================================
  Hits         1525     1525           
  Misses        269      269           
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 96.47% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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