spatialdata-plot
spatialdata-plot copied to clipboard
fix #464
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()
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 85.00%. Comparing base (c5cb734) to head (34ad288).
:warning: Report is 9 commits behind head on main.
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%> (ø) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Thank you @sophiamaedler !